Part Number Hot Search : 
CP494 PST8435R 0213315P DTC123J VHC4052A SD1010 AD667KP QT4AC
Product Description
Full Text Search
 

To Download PIC14000-04SO Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  1996 microchip technology inc. preliminary ds40122b-page 1 high-performance risc cpu: only 35 single word instructions to learn all single cycle instructions except for program branches which are two cycle operating speed: dc - 20 mhz clock input 4096 x 14 on-chip eprom program memory 192 x 8 general purpose registers (sram) 6 internal and 5 external interrupt sources 38 special function hardware registers eight-level hardware stack analog peripherals features: slope analog-to-digital (a/d) converter - eight external input channels including two channels with selectable level shift inputs - six internal input channels - 16-bit programmable timer with capture register - 16 ms maximum conversion time at maxi- mum (16-bit) resolution and 4 mhz clock - 4-bit programmable current source internal bandgap voltage reference factory calibrated with calibration constants stored in eprom on-chip temperature sensor voltage regulator control output two comparators with programmable references on-chip low voltage detector special microcontroller features: power-on reset (por), power-up timer (pwrt) and oscillator start-up timer (ost) watchdog timer (wdt) with its own on-chip rc oscillator for reliable operation multi-segment programmable code-protection selectable oscillator options - internal 4 mhz oscillator - external crystal oscillator serial in-system programming (via two pins) pic14000 28-pin programmable mixed signal controller pin diagram digital peripherals features: 22 i/o pins with individual direction control high current sink/source for direct led drive tmr0: 8-bit timer/counter with 8-bit programmable prescaler 16-bit a/d timer: can be used as a general purpose timer ? 2 c ? serial port compatible with system management bus cmos technology: low-power, high-speed cmos eprom technology fully static design wide-operating voltage range (2.7v to 6.0v) commercial and industrial temperature range low power dissipation (typical) - < 3 ma @5v, 4 mhz operating mode - < 300 m a @3v (sleep mode: clocks stopped with analog circuits active) - < 5 m a @3v (hiber nate mode: clocks stopped, analog inactive, and wdt disabled) applications: battery chargers battery capacity monitoring uninterruptable power supply controllers power management controllers hvac controllers sensing and data acquisition pdip, soic, ssop, windowed cerdip 28 27 26 25 24 23 22 21 20 19 18 17 16 15 ra2/an2 ra3/an3 rd4/an4 rd5/an5 rd6/an6 rd7/an7 cdac sum v ss rc0/refa rc1/cmpa rc2 rc3/t0cki rc4 pic14000 ?1 2 3 4 5 6 7 8 9 10 11 12 13 14 ra1/an1 ra0/an0 rd3/refb rd2/cmpb rd1/sdab rd0/sclb osc2/clkout osc1/pbtn v dd vreg rc7/sdaa rc6/scla rc5 mclr /v pp this document was created with framemake r404
pic14000 ds40122b-page 2 preliminary 1996 microchip technology inc. table of contents 1.0: general description........................................................................................................................... 3 2.0: device varieties ................................................................................................................................ 5 3.0: architectural overview ...................................................................................................................... 7 4.0: memory organization ...................................................................................................................... 13 5.0: i/o ports .......................................................................................................................................... 25 6.0: timer modules................................................................................................................................. 37 7.0: inter-integrated circuit serial port (i 2 c ? )........................................................................................ 41 8.0: analog modules for a/d conversion ............................................................................................... 57 9.0: other analog modules..................................................................................................................... 65 10.0: special features of the cpu ........................................................................................................... 75 11.0: instruction set summary ................................................................................................................. 91 12.0: development support.................................................................................................................... 103 13.0: electrical characteristics for pic14000 ..........................................................................................107 14.0: analog specifications: pic14000-04 (commercial, industrial)...................................................... 123 appendix a:pic16/17 microcontrollers ....................................................................................................133 index .........................................................................................................................................................143 pic14000 product identification system ..................................................................................................149 to our valued customers we constantly strive to improve the quality of all our products and documentation. to this end, we recently converted to a new publishing software package which we believe will enhance our entire documentation process and product. as in any conversion process, information may have accidently been altered or deleted. we have spent an excep- tional amount of time to ensure that these documents are correct. however, we realize that we may have missed a few things. if you ?d any information that is missing or appears in error, please use the reader response form in the back of this data sheet to inform us. we appreciate your assistance in making this a better document.
1996 microchip technology inc. preliminary ds40122b-page 3 pic14000 1.0 general description the pic14000 features include medium to high reso- lution a/d conversion (10 to 16 bits), temperature sens- ing, closed loop charge control, serial communication, and low power operation. the pic14000 uses a risc harvard architecture cpu with separate 14-bit instruction and 8-bit data buses. a two-stage instruction pipeline allows all instructions to execute in a single cycle, except for program branches, which require two cycles. a total of 35 instructions are available. additionally, a large register set is included. pic16/17 microcontrollers typically achieve a 2:1 code compression and a 4:1 speed improvement over other 8-bit microcontrollers. features: the pic14000 is a 28-pin device with these features: 4k of eprom 192 bytes of ram 22 i/o pins the analog peripherals include: 8 external analog input channels, two with level shift inputs 6 internal analog input channels 2 comparators with programmable references a bandgap reference an internal temperature sensor a programmable current source in addition, the i 2 c serial port through a multiplexer supports two separate i 2 c channels. a special oscillator option allows either an internal 4 mhz oscillator or an external crystal oscillator. using the internal 4 mhz oscillator requires no external com- ponents. the pic14000 contains three timers, the watchdog timer (wdt), timer0 (tmr0), and a/d timer (adtmr). the watchdog timer includes its own on-chip rc o scillator providing protection against software lock-up. tmr0 is a general purpose 8-bit timer/counter with an 8-bit prescaler. it may be clocked externally using the rc3/t0cki pin. the adtmr is intended for use with the slope a/d converter, but can also be used as a general purpose timer. it has an associated capture register which can be used to mea- sure the time between events. an internal low-voltage detect circuit allows for tracking of voltage levels. upon detecting the low voltage con- dition, the pic14000 can be instructed to save its oper- ating state then enter an idle state. the internal band-gap reference is used for calibrating the measurements of the analog peripherals. the calibration factors are stored in eprom and can be used to achieve high measurement accuracy. power savings modes are available for portable appli- cations. the sleep and hibernate modes offer dif- ferent levels of power savings. the pic14000 can wake up from these modes through interrupts or reset. a uv erasable cerdip packaged version is ideal for code development, while the cost-effective one-time programmable (otp) version is suitable for production in any volume. the pic14000 ?s perfectly in applications for battery charging, capacity monitoring, and data logging. the eprom technology makes customization of application programs (battery characteristics, feature sets, etc.) extremely fast and convenient. the small footprint packages make this microcontroller based mixed signal device perfect for all applications with space limitations. low-cost, low-power, high perfor- mance, ease of use and i/o ?xibility make the pic14000 very versatile in other applications such as temperature monitors/controllers. 1.1 f amil y and upwar d compatibility code written for pic16c6x/7x can be easily ported to the pic14000 (see appendix a). 1.2 de velopment suppor t the pic14000 is supported by a full-featured macro assembler, a software simulator, an in-circuit emulator, a low-cost development programmer and a full-featured programmer. a ??compiler and fuzzy logic support tools are also available. this document was created with framemake r404
pic14000 ds40122b-page 4 preliminary 1996 microchip technology inc. notes:
1996 microchip technology inc. preliminary ds40122b-page 5 pic14000 2.0 device varieties a variety of frequency ranges and packaging options are available. the pic14000 product selection system section at the end of this data sheet provides the devices options to be selected for your speci? applica- tion and production requirements. when placing orders, please use the ?ic14000 product identi?a- tion system?at the back of this data sheet to specify the correct part number. 2.1 uv erasab le de vices the uv erasable version, offered in cerdip package, is optimal for prototype development and pilot programs. the uv erasable version can be erased and reprogrammed to any of the con?uration modes. microchip's picstart , picstart-plus and pro mate programmers all support programming of the pic14000. third party programmers also are avail- able; refer to the microchip third party guide for a list of sources. 2.2 one-time-pr ogrammab le (o tp) de vices the availability of otp devices is especially useful for customers who need the ?xibility for frequent code updates or small volume applications. the otp devices, packaged in plastic packages permit the user to program them once. in addition to the program memory, the con?uration bits must also be programmed. note: please note that erasing the device will also erase the pre-programmed calibration factors. please refer to an621 for more information. 2.3 quic k-t urnar ound-pr oduction (qtp) de vices microchip offers a qtp programming service for factory production orders. this service is made available for users who choose not to program a medium to high quantity of units and whose code patterns have stabilized. the devices are identical to the otp devices but with all eprom locations and fuse options already programmed by the factory. certain code and prototype veri?ation procedures do apply before production shipments are available. please contact your local microchip technology sales of?e for more details. 2.4 serializ ed quic k-t urnar ound pr oduction (sqtp sm ) de vices microchip offers a unique programming service where a few user-de?ed locations in each device are programmed with different serial numbers. the serial numbers may be random, pseudo-random or sequential. serial programming allows each device to have a unique number which can serve as an entry-code, password or id number. this document was created with framemake r404
pic14000 ds40122b-page 6 preliminary 1996 microchip technology inc. notes:
1996 microchip technology inc. preliminary ds40122b-page 7 pic14000 3.0 architectural overview the pic14000 addresses 4k x 14 program memory. all program memory is internal. the pic14000 can directly or indirectly address its register ?es or data memory. all special function registers including the program counter are mapped in the data memory. the pic14000 has an orthogonal instruction set that makes it possible to carry out any operation on any register using any addressing mode. this symmetrical nature and lack of ?pecial optimal situations make programming with the pic14000 simple yet ef?ient. in addition, the learning curve is reduced signi?antly. the pic14000 contains an 8-bit alu and working register. the alu performs arithmetic and boolean functions between data in the working register and any register ?e. the alu is capable of addition, subtraction, shift, and logical operations. unless otherwise mentioned, arithmetic operations are two's complement. in two-operand instructions, typically one operand is the working register (w register). the other operand is a ?e register or an immediate constant. in single operand instructions, the operand is either the w register or a ?e register. depending on the instruction executed, the alu may affect the values of the carry (c), digit carry (dc), and zero (z) bits in the status register. the c and dc bits operate as a borrow bit and a digit borrow out bit, respectively, in subtraction. see the sublw and subwf instructions for examples. a simpli?d block diagram for the pic14000 is shown in figure 3-1, its corresponding pin description is shown in table 3-1. this document was created with framemake r404
pic14000 ds40122b-page 8 preliminary 1996 microchip technology inc. figure 3-1: pic14000 block diagram eprom program memory 4k x 14 13 data bus 8 14 program bus instruction reg program counter 8 level stack (13-bit) ram file registers 192 x 8 direct addr 7 ram addr (1) 9 addr mux indirect addr fsr reg status reg mux alu w reg power-up timer oscillator start-up timer power-on reset watchdog timer instruction decode & control timing generation osc1/pbtn osc2/clkout mclr /v pp v dd , v ss porta portc rc0/refa rc1/cmpa rc2 rc3/t0cki rc4 rc5 rc6/scla rc7/sdaa 8 8 low voltage detector note 1: higher order bits are from the status register. i 2 c timer0 serial port ra3/an3 ra2/an2 ra1/an1 ra0/an0 8 3 rd0/sclb rd1/sdab sum cdac slope a/d portd rd2/cmpb rd3/refb rd4/an4 rd5/an5 rd6/an6 rd7/an7 internal oscillator bandgap temp programmable sensor reference reference a & b with comparators vreg voltage regulator support
1996 microchip technology inc. preliminary ds40122b-page 9 pic14000 table 3-1: pin descriptions pin name pin no. i/o pin type input output description cdac 22 o an a/d ramp current source output. normally connected to external capacitor to generate a linear voltage ramp. ra0/an0 2 i/o an/st cmos analog input channel 0. this pin can also serve as a general-purpose i/o. ra1/an1 1 i/o an/st cmos analog input channel 1. this pin can connect to a level shift network. if enabled, a +0.5v offset is added to the input voltage. this pin can also serve as a general- purpose i/o. ra2/an2 28 i/o an/st cmos analog input channel 2. this pin can also serve as a general purpose digital i/o. ra3/an3 27 i/o an/st cmos analog input channel 3. this pin can also serve as a gen- eral purpose digital i/o. sum 21 o an an1 summing junction output. this pin can be connected to an external capacitor for averaging small duration pulses. rc0/refa 19 i/o-pu st cmos led direct-drive output or programmable reference a out- put. this pin can also serve as a gpio. if enabled, this pin has a weak internal pull-up to v dd . rc1/cmpa 18 i/o-pu st cmos led direct-drive output or comparator a output. this pin can also serve as a gpio. if enabled, this pin has a weak internal pull-up to v dd . rc2 17 i/o-pu st cmos led direct-drive output. this pin can also serve as a gpio. if enabled, this pin has a weak internal pull-up to v dd rc3/t0cki 16 i/o-pu st cmos led direct-drive output. this pin can also serve as a gpio, or an external clock input for timer0. if enabled, this pin has a weak internal pull-up to v dd . rc4 15 i/o-pu st cmos led direct-drive output. this pin can also serve as a gpio. if enabled, a change on this pin can cause a cpu interrupt. if enabled, this pin has a weak internal pull-up to v dd . rc5 13 i/o-pu st cmos led direct-drive output. this pin can also serve as a gpio. if enabled, a change on this pin can cause a cpu interrupt. if enabled, this pin has a weak internal pull-up to v dd . rc6/scla 12 i/o st/sm npu/od (no p-diode) general purpose i/o. if enabled, is multiplexed as synchronous serial clock for i 2 c interface. also is the serial programming clock. if enabled, a change on this pin can cause a cpu interrupt. this pin has an n-channel pull-up device which is disabled in i 2 c mode. rc7/sdaa 11 i/o st/sm npu/od (no p-diode) general purpose i/o. if enabled, is multiplexed as synchronous serial data i/o for i 2 c interface. also is the serial programming data line. if enabled, a change on this pin can cause a cpu interrupt. this pin has an n-channel pull-up device which is disabled in i 2 c mode. rd0/sclb 6 i/o st/sm npu/od (no p-diode) general purpose i/o. if enabled, is multiplexed as synchronous serial clock for i 2 c interface. this pin has an n-channel pull-up device which is disabled in i 2 c mode. rd1/sdab 5 i/o st/sm npu/od (no p-diode) general purpose i/o. if enabled, is multiplexed as synchronous serial data i/o for i 2 c interface. this pin has an n-channel pull-up device which is disabled in i 2 c mode. rd2/cmpb 4 i/o-pu an/st cmos general purpose i/o or comparator b output.
pic14000 ds40122b-page 10 preliminary 1996 microchip technology inc. legend: rd3/refb 3 i/o-pu an/st cmos general purpose i/o or programmable reference b output. rd4/an4 26 i/o an/st cmos analog input channel 4. this pin can also serve as a gpio. rd5/an5 25 i/o an/st cmos analog input channel 5. this pin can connect to a level shift network. if enabled, a +0.5v offset is added to the input voltage. this pin can also serve as a gpio. rd6/an6 24 i/o an/st cmos analog input channel 6. this pin can also serve as a gpio. rd7/an7 23 i/o an/st cmos analog input channel 7. this pin can also serve as a gpio. vreg 10 o an this pin is an output to control the gate of an external n-fet for voltage regulation. osc1/pbtn 8 i-pu st in mode: input with weak pull-up resistor, can be used to generate an interrupt. hs mode: external oscillator input. osc2/ clkout 7 o cmos in mode: general purpose output. hs mode: external oscillator/clock output. mclr /vpp 14 i/pwr st master clear (reset) input / programming voltage input. this pin is an active low reset to the device. v dd 9 pwr positive supply connection v ss 20 gnd return supply connection type: de?ition: ttl ttl-compatible input cmos cmos-compatible input or output st schmitt trigger input, with cmos levels sm smbus compatible input od open-drain output. an external pull-up resistor is required if this pin is used as an output. npu n-channel pull-up. this pin will pull-up to approximately v dd - 1.0v when outputting a logical ?? pu weak internal pull-up (10k-50k ohms) no-p diode no p-diode to v dd . this pin may be pulled above the supply rail (to 6.0v maximum). an analog input or output table 3-1: pin descriptions (continued) pin name pin no. i/o pin type input output description
1996 microchip technology inc. preliminary ds40122b-page 11 pic14000 3.1 cloc king sc heme/ instruction cyc le the clock input (from osc1 or the internal oscillator) is internally divided by four to generate four non-overlapping quadrature clocks, namely q1, q2, q3 and q4. the program counter (pc) is incremented every q1, the instruction is fetched from the program memory and latched into the instruction register in q4. the instruction is decoded and executed during the following q1 through q4. the clocks and instruction execution ?w are shown in figure 3-2. 3.2 instruction flo w/pipelining an ?nstruction cycle?consists of four q cycles (q1, q2, q3 and q4). the instruction fetch and execute are pipelined such that fetch takes one instruction cycle while decode and execute takes another instruction cycle. however, due to the pipelining, each instruction effectively executes in one cycle. if an instruction causes the program counter to change (e.g., goto) then two cycles are required to complete the instruction (example 3-1). a fetch cycle begins with the program counter (pc) incrementing in q1. in the execution cycle, the fetched instruction is latched into the ?nstruction register (ir)?in cycle q1. this instruction is then decoded and executed during the q2, q3, and q4 cycles. data memory is read during q2 (operand read) and written during q4 (destination write). figure 3-2: clock/instruction cycle example 3-1: instruction pipeline flow q1 q2 q3 q4 q1 q2 q3 q4 q1 q2 q3 q4 osc1 q1 q2 q3 q4 pc clkout (in mode) pc pc+1 pc+2 fetch inst (pc) execute inst (pc-1) fetch inst (pc+1) execute inst (pc) fetch inst (pc+2) execute inst (pc+1) internal phase clock 1. movlw 55h 2. movwf portb 3. call sub_1 4. bsf porta, bit3 fetch 1 fetch 2 fetch 3 fetch sub_1 execute 1 flush all instructions are single cycle, except for program branches. these take two cycles since the fetched instruction is ?lushed?from the pipeline while the new instruction is being fetched and then executed. execute 2 flush fetch 4 fetch sub_1 execute 3
pic14000 ds40122b-page 12 preliminary 1996 microchip technology inc. notes:
1996 microchip technology inc. preliminary ds40122b-page 13 pic14000 4.0 memory organization 4.1 pr ogram memor y or ganization the pic14000 has a 13-bit program counter capable of addressing an 8k x 14 program memory space. only the ?st 4k x 14 (0000-0fffh) are physically imple- mented. accessing a location above the physically implemented address will cause a wraparound. the reset vector is at 0000h and the interrupt vector is at 0004h (figure 4-1). the 4096 words of program memory space are divided into: address vectors (addr 0000h-0004h) program memory page 0 (addr 0005h-07ffh) program memory page 1 (addr 0800h-0fbfh) calibration space (64 words, addr 0fc0h-0fffh) program code may reside in page 0 and page 1. figure 4-1: pic14000 program memory map and stack pc<12:0> stack level 1 stack level 8 reset vector interrupt vector program memory & calibration space call, return, retfie, retlw 13 0000h 0004h 0005h 0fffh 1000h 20ffh 07ffh (4096 words) on-chip program memory (page 0) 0800h on-chip program memory (page 1) calibration space (64 words) 0fc0h 0fbfh 4.1.1 calibration space the calibration space is not used for instructions. this section stores constants and factors for the arithmetic calculations to calibrate the analog measurements. table 4-1: calibration data overview* * refer to an621 for details. ** microchip modi?d ieee754 32-bit ?ating point format. refer to application note an575 for details. address parameter symbol units format 0fc0h-0fc3h slope reference ratio k ref n/a 32-bit ?ating point ** 0fc4h-0fc7h bandgap reference voltage k bg volts 32-bit ?ating point 0fc8h-0fcbh tempera- ture sensor voltage v therm volts 32-bit ?ating point 0fcch-0fcfh tempera- ture sensor coef?ient k tc volts/ degree celsius 32-bit ?ating point 0fd0h internal oscillator frequency multiplier f osc n/a byte 0fd2h wdt time-out t wdt ms byte this document was created with framemake r404
pic14000 ds40122b-page 14 preliminary 1996 microchip technology inc. table 4-2: calibration constant addresses 4.2 data memor y or ganization the data memory (figure 4-2) is partitioned into two banks which contain the general purpose registers and the special function registers. bank 0 is selected when the rp0 bit in the status register is cleared. bank 1 is selected when the rp0 bit in the status register is set. each bank extends up to 7fh (128 bytes). the ?st 32 locations of each bank are reserved for the special function registers. several special function registers are mapped in both bank 0 and bank 1. the general purpose registers, implemented as static ram, are located from address 20h through 7fh, and a0 through ff. address data 0fc0h k ref , exponent 0fc1h k ref , mantissa high byte 0fc2h k ref , mantissa middle byte 0fc3h k ref , mantissa low byte 0fc4h k bg , exponent 0fc5h k bg , mantissa high byte 0fc6h k bg , mantissa middle byte 0fc7h k bg , mantissa low byte 0fc8h v therm , exponent 0fc9h v therm , mantissa high byte 0fcah v therm , mantissa middle byte 0fcbh v therm , mantissa low byte 0fcch k tc , exponent 0fcdh k tc , mantissa high byte 0fceh k tc , mantissa middle byte 0fcfh k tc , mantissa low byte 0fd0h f osc , unsigned byte 0fd1h reserved 0fd2h t wdt , unsigned byte 0fd3h - 0ff8h reserved 0ff9h-fh calibration space checksums 4.2.1 general purpose register file the register ?e is accessed either directly, or indirectly through the ?e select register fsr (section 4.4). figure 4-2: register file map file address * not a physical register. shaded areas are unimplemented memory locations, read as ?s. 00h indirect add.(*) indirect addr.(*) 80h 01h tmr0 option 81h 02h pcl pcl 82h 03h status status 83h 04h fsr fsr 84h 05h porta trisa 85h 06h reserved reserved 86h 07h portc trisc 87h 08h portd trisd 88h 09h 89h 0ah pclath pclath 8ah 0bh intcon intcon 8bh 0ch pir1 pie1 8ch 0dh 8dh 0eh adtmrl pcon 8eh 0fh adtmrh slpcon 8fh 10h 90h 11h 91h 12h 92h 13h i 2 cbuf i 2 cadd 93h 14h i 2 ccon i 2 cstat 94h 15h adcapl 95h 16h adcaph 96h 17h 97h 18h 98h 19h 99h 1ah 9ah 1bh prefa 9bh 1ch prefb 9ch 1dh cmcon 9dh 1eh misc 9eh 1fh adcon0 adcon1 9fh 20h general purpose register (96 bytes) general purpose register (96 bytes) a0h 7f ff
1996 microchip technology inc. preliminary ds40122b-page 15 pic14000 4.2.2 special function registers the special function registers are registers used by the cpu and peripheral functions for controlling the desired operation of the device (table 4-3). these reg- isters are static ram. the special registers are classi?d into two sets. special registers associated with the ?ore?functions are described in this section. those registers related to the operation of the peripheral features are described in the section speci? to that peripheral. table 4-3: special function registers for the pic14000 address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 bank0 00h* indf (indirect address) addressing this location uses contents of the fsr to address data memory (not a physical register). 01h tmr0 timer0 data 02h* pcl program counter? (pc?) least significant byte 03h* status irp rp1 rp0 to pd z dc c 04h* fsr indirect data memory address pointer 05h porta porta data latch. 06h reserved reserved for emulation. 07h portc portc data latch 08h portd portd data latch 09h reserved 0ah* pclath buffered register for the upper 5 bits of the program counter (pc) 0bh* intcon gie peie t0ie r r t0if r r 0ch pir1 cmif pbif i 2 cif rcif adcif ovfif 0dh reserved 0eh adtmrl a/d capture timer data least significant byte 0fh adtmrh a/d capture timer data most significant byte 10h reserved 11h reserved 12h reserved 13h i 2 cbuf i 2 c serial port receive buffer/transmit register 14h i 2 ccon wcol i 2 cov i 2 cen ckp i 2 cm3 i 2 cm2 i 2 cm1 i 2 cm0 15h adcapl a/d capture latch least significant byte 16h adcaph a/d capture latch most significant byte 17h reserved 18h reserved 19h reserved 1ah reserved 1bh reserved 1ch reserved 1dh reserved 1eh reserved 1fh adcon0 adcs3 adcs2 adcs1 adcs0 amuxoe adrst adzero legend ?= unimplemented bits, read as ? but cannot be overwritten r = reserved bits, default is por value and should not be overwritten with any value reserved indicates reserved register and should not be overwritten with any value * indicates registers that can be addressed from either bank
pic14000 ds40122b-page 16 preliminary 1996 microchip technology inc. bank1 80h* indf (indirect ad- dress) addressing this location uses contents of fsr to address data memory (not a physical regis- ter). 81h option rcpu r tocs tose psa ps2 ps1 ps0 82h* pcl program counter? (pc?) least significant byte 83h* status irp rp1 rp0 to pd z dc c 84h* fsr indirect data memory address pointer 85h trisa porta data direction register 86h reserved reserved for emulation 87h trisc portc data direction register 88h trisd portd data direction register 89h reserved 8ah* pclath buffered register for the upper 5 bits of the program counter (pc) 8bh* intcon gie peie t0ie r r t0if r r 8ch pie1 cmie pbie i 2 cie rcie adcie ovfie 8dh reserved 8eh pcon r por lvd 8fh slpcon hiben refoff lsoff oscoff cmoff tempoff adoff 90h reserved 91h reserved 92h reserved 93h i 2 cadd i 2 c synchronous serial port address register 94h i 2 cstat d/a p s r/w ua bf 95h reserved 96h reserved 97h reserved 98h reserved 99h reserved 9ah reserved 9bh prefa pra7 pra6 pra5 pra4 pra3 pra2 pra1 pra0 9ch prefb prb7 prb6 prb5 prb4 prb3 prb2 prb1 prb0 9dh cmcon cmbout cmboe cpolb cmaout cmaoe cpola 9eh misc smhog spgndb spgnda i 2 csel smbus inclken osc2 osc1 9fh adcon1 addac3 addac2 addac1 addac0 pcfg3 pcfg2 pcfg1 pcfg0 table 4-3: special function registers for the pic14000 (continued) address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 legend ?= unimplemented bits, read as ? but cannot be overwritten r = reserved bits, default is por value and should not be overwritten with any value reserved indicates reserved register and should not be overwritten with any value * indicates registers that can be addressed from either bank
1996 microchip technology inc. preliminary ds40122b-page 17 pic14000 4.2.2.1 status register the status register, shown in figure 4-3, contains the arithmetic status of the alu, the reset status and the bank select bits for data memory. the status register can be the destination for any instruction, as with any other register. if the status register is the destination for an instruction that affects the z, dc or c bits, then the write to these three bits is disabled. these bits are set or cleared according to the device logic. furthermore, the t o and pd bits are not writable. therefore, the result of an instruction with the status register as destination may be different than intended. for example, clrf status will clear the upper-three bits and set the z bit. this leaves the status register as 000u u1uu (where u = unchanged). it is recommended, therefore, that only bcf, bsf, swapf and movwf instructions are used to alter the status register because these instructions do not affect the z, c or dc bits from the status register. for other instructions, not affecting any status bits, see the ?nstruction set summary.? note 1: the irp and rp1 bits (status<7:6>) are not used by the pic14000 and should be programmed as cleared. use of these bits as general purpose r/w bits is not recommended, since this may affect upward compatibility with future products. note 2: the c and dc bits operate as a borrow and digit borrow out bit, respectively, in subtraction. see the sublw and subwf instructions for examples. figure 4-3: status register 83h bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 status irp rp1 rp0 to pd z dc c read/write r/w r/w r/w r r r/w r/w r/w por value ffh 00 011xxx bit name function b7 irp not used. this bit should be programmed as ?? use of this bit as a general purpose read/write bit is not recommended, since this may affect upward compatibility with future products. b6 rp1 not used. this bit should be programmed as ?? use of this bit as a general purpose read/write bit is not recommended, since this may affect upward compatibility with future products. b5 rp0 register page select for direct addressing. 1 = bank1 (80h - ffh) 0 = bank0 (00h - 7fh) each page is 128 bytes. only the rp0 bit is used. b4 t o time-out bit. 1 = after power-up and by the clrwdt and sleep instruction. 0 = a watchdog timer time-out has occurred. b3 pd power down bit. 1 = after power-up or by a clrwdt instruction. 0 = by execution of the sleep instruction. b2 z zero bit. 1 = the result of an arithmetic or logic operation is zero. 0 = the result of an arithmetic or logical operation is not zero. b1 dc digit carry / borrow bit. for addwf and addlw instructions. 1 = a carry-out from the 4th low order bit of the result. 0 = no carry-out from the 4th low order bit of the result. note: for borrow, the polarity is reversed. b0 c carry / borrow bit. for addwf and addlw instructions. 1 = a carry-out from the most signi?ant bit of the result occurred. note that a subtraction is executed by adding the twos complement of the second operand. for rotate ( rrf, rlf ) instructions, this bit is loaded with either the high or low order bit of the source register. 0 = no carry-out from the most signi?ant bit of the result. note: for borrow the polarity is reversed.
pic14000 ds40122b-page 18 preliminary 1996 microchip technology inc. 4.2.2.2 option register the option register (address 81h) is a readable and writable register which contains various control bits to con?ure the tmr0/wdt prescaler, tmr0, and the weak pull-ups on portc<5:0>. bit 6 is reserved. note: to achieve a 1:1 prescaler assignment, assign the prescaler to the wdt (psa=1) figure 4-4: option register rcpu : portc pull-up enable psa ps2 ps1 ps0 r/w r/w r/w r/w r/w r/w r/w r/w bit0 rcpu r t0cs t0se bit7 ps2 ps1 ps0 psa: prescaler assignment bit t0se: tmr0 source edge t0cs: tmr0 clock source prescaler value 0 0 0 0 1 1 1 0 0 1 1 0 0 1 0 1 0 1 0 1 0 1 : 2 1 : 4 1 : 8 1 : 16 1 : 32 1 : 64 1 : 128 1 : 256 1 : 1 1 : 2 1 : 4 1 : 8 1 : 16 1 : 32 1 : 64 1 : 128 reserved. this bit should be programmed as a ?? use of this bit as address: 81h por value: ffh w: writable r: readable u: unimplemented. read as '0' tmr0 rate wdt rate 1 = prescaler assigned to the wdt 0 = prescaler assigned to tmr0 1 = increment on high-to-low transition on rc3/t0cki pin 0 = increment on low-to-high transition on rc3/t0cki pin 1 = transition on rc3/t0cki pin 0 = internal instruction cycle clock (clkout) 1 = portc pull-ups are disabled overriding any port latch value (rc<5:0> only) 0 = portc pull-ups are enabled by individual port-latch values (rc<5:0>) ps2:ps0 11 1 register: option general purpose read/write is not recommended since this may affect upward compatibility with future products.
1996 microchip technology inc. preliminary ds40122b-page 19 pic14000 4.2.2.3 intcon register the intcon register is a readable and writable register which contains the various enable and ?g bits for the timer0 over?w and peripheral interrupts. figure 4-5 shows the bits for the intcon register. note: the t0if will be set by the speci?d condition even if the corresponding inter- rupt enable bit is cleared (interrupt disabled) or the gie bit is cleared (all interrupts disabled). before enabling interrupt, clear the interrupt ?g, to ensure that the program does not immediately branch to the peripheral interrupt service routine figure 4-5: intcon register gie peie t0ie r r/w r/w r/w r/w r/w r/w r/w r/w w: writable r: readable u: unimplemented, read as '0' register: intcon address: 0bh or 8bh por value: 0000 000xb t0if: tmr0 overflow interrupt flag 1 = the tmr0 has overflowed must be cleared by software 0 = tmr0 did not overflow t0ie: tmr0 interrupt enable bit 1 = enables t0if interrupt 0 = disables t0if interrupt peie: peripheral interrupt enable bit 1 = enables all un-masked peripheral interrupts 0 = disables all peripheral interrupts gie: global interrupt enable 1 = enables all un-masked interrupts 0 = disables all interrupts bit7 bit0 r r r t0if reserved. this bit should be programmed as ?? use of this bit as a general purpose read/write bit is not recommended, since this may affect upward compatibility with future products. reserved. this bit should be programmed as ?? use of this bit as a general purpose read/write bit is not recommended, since this may affect upward compatibility with future products. reserved. this bit should be programmed as ?? use of this bit as a general purpose read/write bit is not recommended, since this may affect upward compatibility with future products. reserved. this bit should be programmed as ?? use of this bit as a general purpose read/write bit is not recommended, since this may affect upward compatibility with future products.
pic14000 ds40122b-page 20 preliminary 1996 microchip technology inc. 4.2.2.4 pie1 register this register contains the individual enable bits for the peripheral interrupts including a/d capture event, i 2 c serial port, portc change and a/d capture timer over?w, and external push button. note: intcon<6> must be enabled to enable any interrupt in pie1. figure 4-6: pie1 register w: writable r: readable u: unimplemented, read as '0' register: pie1 address: 8ch por value: 00h r/w r r r/w r/w r/w r/w r/w bit0 bit7 ovfie: a/d counter overflow interrupt enable 1 = enables a/d counter overflow interrupt 0 = disables a/d counter overflow interrupt adcie: a/d capture interrupt enable 1 = a/d capture interrupt is enabled 0 = a/d capture interrupt is disabled rcie: portc interrupt on change enable 1 = enables rcif interrupt on pins, rc<7:4> 0 = disables rcif interrupt i 2 cie: i 2 c port interrupt enable 1 = enables i 2 cif interrupt 0 = disables i 2 cif interrupt pbie: external pushbutton interrupt enable 0 = disable pbtn interrupt on osc1/pbtn 1 = enable pbtn (pushbutton) interrupt on osc1/pbtn. unimplemented. read as ? unimplemented. read as ? cmie: programmable reference comparator interrupt enable 1 = enable programmable reference comparator trip 0 = disable programmable reference comparator trip cmie pbie i 2 cie rcie adcie ovfie (note this interrupt not available in hs mode).
1996 microchip technology inc. preliminary ds40122b-page 21 pic14000 4.2.2.5 pir1 register this register contains the individual ?g bits for the peripheral interrupts (figure 4-7). note: these bits will be set by the speci?d condition, even if the corresponding interrupt enable bit is cleared (interrupt disabled) or the gie bit is cleared (all interrupts disabled). before enabling an interrupt, the user may wish to clear the corresponding interrupt ?g, to ensure that the program does not immediately branch to the peripheral interrupt service routine. figure 4-7: pir1 register cmif r/w r r r/w r/w r/w r/w r/w bit0 bit7 cmif: programmable reference comparator interrupt flag 1 = the comparator output has tripped. this is a 0 = the interrupt did not occur unimplemented. read as ? w: writable r: readable u: unimplemented, read as ? register: pir1 address: 0ch por value: 00h pbif i 2 cif rcif adcif ovfif unimplemented. read as ? ovfif: a/d counter overflow interrupt flag 1 = an a/d counter overflow has occurred. must be cleared in software. 0 = an a/d counter overflow has not occurred adcif: a/d capture interrupt flag 1 = an a/d capture has occurred. must be cleared in software. 0 = an a/d capture has not occurred rcif: portc interrupt on change flag 1 = at least one rc<7:4> input changed. must be cleared in software. 0 =none of the rc<7:4> inputs have changed i 2 cif: i 2 c port interrupt flag 1 = a transmission/reception is completed. must be cleared in software. 0 =waiting to transmit/receive pbif: external pushbutton interrupt flag 1 = the external pushbutton interrupt has occurred 0 =the external pushbutton interrupt did not occur on osc1/pbtn. note: this interrupt is not available in hs mode. level-sensitive interrupt.
pic14000 ds40122b-page 22 preliminary 1996 microchip technology inc. 4.2.2.6 pcon register the power control (pcon) register status contains 2 ?g bits to allow differentiation between a power-on reset, an external mclr reset, wdt reset, or low-volt- age condition (figure 4-8). these bits are cleared on por. the user must set these bits following por. on a subsequent reset if por is cleared, this is an indication that the reset was due to a power-on reset condition. note: l vd is unknown on power-on reset. it must then be set by the user and checked on subsequent resets to see if l vd is cleared, indicating a low voltage condition has occurred. figure 4-8: pcon register bit7 bit0 lvd por lvd : low voltage detect flag 1 = a low-voltage detect condition has not occurred. 0 = a low-voltage detect condition has occurred. software must set this bit after a power-on-reset condition has occurred. reserved. bit 7 is reserved. this bit should be r/w r/w r/w u u u u u r w: writable r: readable u: unimplemented, read as ? register: pcon address: 8eh por value: 0000_000xb por : power on reset flag 1 = a power on reset condition has not occurred. 0 = a power on reset condition has occurred. software must set this bit after a power-on-reset condition has occurred. reset must be due to some other source (wdt, mclr ). programmed as ??. unimplemented. read as ? unimplemented. read as ? unimplemented. read as ? unimplemented. read as ? unimplemented. read as ?
1996 microchip technology inc. preliminary ds40122b-page 23 pic14000 4.3 pcl and pcla th the program counter (pc) is 13-bits wide. the low byte, pcl, is a readable and writable register. the high byte of the pc (pch) is not directly readable or writable. pclath is a holding register for pc<12:8> where contents are transferred to the upper byte of the program counter. when pc is loaded with a new value during a call, goto or a write to pcl, the high bits of pc are loaded from pclath as shown in figure 4-9. figure 4-9: loading of pc in different situations 4.3.1 computed goto when doing a table read using a computed goto method, care should be exercised if the table location crosses a pcl memory boundary (each 256 byte block). refer to the application note ?able read using the pic16cxx?an556). 4.3.2 stack the pic14000 has an 8 deep x 13-bit wide hardware stack (figure 4-1). the stack space is not part of either program or data space and the stack pointer is not readable or writable. the pc is pushed in the stack when a call instruction is executed or an interrupt is acknowledged. the stack is poped in the event of a return, retlw or a retfie instruction execution. pclath is not affected by a ?ush?or a ?op operation. the stack operates as a circular buffer. this means that after the stack has been ?ushed?eight times, the ninth push overwrites the value that was stored from the ?st push. the tenth push overwrites the second push (and so on). note: on por, the contents of the pclath register are unknown. the pclath should be initialized before a call, goto, or any instruction that modi?s the pcl register is executed. pc 12 8 7 0 5 pclath<4:0> pclath inst with pcl a s dest alu result got o, call opcode <10:0> 8 pc 12 11 10 0 11 pclath<4:3> pch pcl 87 2 pclath pch pcl 4.3.3 program memory paging the pic14000 has 4k of program memory, but the call and goto instructions only have a 11-bit address range. this 11-bit address range allows a branch within a 2k program memory page size. to allow call and goto instructions to address the entire 4k program memory address range, there must be another bit to specify the program memory page. this paging bit comes from the pclath<3> bit (figure 4-9). when doing a call or goto instruction, the user must ensure that this page bit (pclath<3>) is programmed to the desired program memory page. if a call instruction (or interrupt) is executed, the entire 13-bit pc is pushed onto the stack. therefore, manipulation of the pclath<3> is not required for the return instructions (which pops the pc from the stack). example 4-1 shows the calling of a subroutine in page 1 of the program memory. this example assumes that the pclath is saved and restored by the interrupt service routine (if interrupts are used). example 4-1: call of a subroutine in page 1 from page 0 note 1: there are no status bits to indicate stack over?w or stack under?w conditions. note 2: there are no instruction mnemonics called push nor pop. these are actions that occur from the execution of the call, return, retlw, or retfie instructions, or the vectoring to an interrupt address note: the pic14000 ignores the pclath<4> bit, which is used for program memory pages 2 and 3 (1000h-1fffh). the use of pclath<4> as a general purpose read/write bit is not recommended since this may affect upward compatibility with future products. org 0x500 bsf pclath, 3 ; select page 1 (800h-fffh) call sub1_p1 ; call subroutine in : ; page 1 (800h-fffh) : : org 0x900 sub1 p1 : ; called subroutine : ; page 1 (800h-fffh) : return ; return to page 0 ; (000h-7ffh)
pic14000 ds40122b-page 24 preliminary 1996 microchip technology inc. 4.4 indirect ad dressing, indf and fsr register s the indf register is not a physical register. addressing the indf register will cause indirect addressing. indirect addressing is possible by using the indf register. any instruction using the indf register actually accesses data pointed to by the ?e select register (fsr). reading indf itself indirectly will produce 00h. writing to the indf register indirectly results in a no-operation (although status bits may be affected). an effective 9-bit address is obtained by concatenating the 8-bit fsr register and the irp bit (status<7>), as shown in figure 4-10. however, irp is not used in the pic14000. a simple program to clear ram location 20h-2fh using indirect addressing is shown in example 4-2. example 4-2: indirect addressing movlw 0x20 ;initialize pointer movf fsr ;to ram next clrf indf ;clear indf register incf fsr ;inc pointer btfss fsr,4 ;all done? goto next ;no clear next ;yes continue continue: figure 4-10: indirect/indirect addressing note: for memory map detail see figure 4-1. 00 00 01 10 11 00 irp 7 fsr 00 bank select location select 0 6 from opcode location select bank select rp1 rp0 indirect addressing direct addressing data memory not used bank 0 bank 1 bank 2 bank 3 7f 7f
1996 microchip technology inc. preliminary ds40122b-page 25 pic14000 5.0 i/o ports the pic14000 has three ports, porta, portc and portd, described in the following paragraphs. generally, porta is used as the analog input port. portc is used for general purpose i/o and for host communication. portd provides additional i/o lines. four lines of portd may function as analog inputs. 5.1 por t a and trisa porta is a 4-bit wide port with data register located at location 05h and corresponding data direction register (trisa) at 85h. porta can operate as either analog inputs for the internal a/d converter or as general purp ose digital i/o ports. these inputs are schmitt triggers when used as digital inputs, and have cmos drivers as outputs. porta pins are multiplexed with analog inputs. adcon1<1:0> bits control whether these pins are analog or digital as shown in section 8.7. when con?- ured to the digital mode, reading the porta register reads the status of the pins whereas writing to it will write to the port latch. when selected as an analog input, these pins will read as ?s. the trisa register controls the direction of the porta pins, even when they are being used as analog inputs. the user must make sure to keep the pins con?ured as inputs when using them as analog inputs. a ? in each location con?ures the corresponding port pin as an input. this register resets to all ?s, meaning all porta pins are initially inputs. the data register should be initialized prior to con?uring the port as out- puts. see figure 5-2 and figure 5-3. porta inputs go through a schmitt trigger and gate that is disabled when the input is in analog mode. refer to figure 5-1. note that bits ra<7:4> are unimplemented and always read as ?? unused inputs should not be left ?ating to avoid leakage currents. all pins have input protection diodes to v dd and v ss . example 5-1: initializing porta note: on reset, porta is con?ured as analog inputs clrf porta ;initialize porta by setting ;output data latches bsf status, rp0 ;select bank1 movlw 0x0f ;value used to initialize ;data direction movwf trisa ;set ra<3:0> as inputs figure 5-1: porta block diagram d q ck q d q ck q d q en data bus write porta write trisa read trisa read porta to a/d converter note: i/o pins have protection diodes to v dd and v ss . p n i/o pin v ss v dd schmitt trigger analog input mode input buffer this document was created with framemake r404
pic14000 ds40122b-page 26 preliminary 1996 microchip technology inc. figure 5-2: porta data register 05h bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 porta ra3/an3 ra2/an2 ra1/an1 ra0/an0 read/write u u u u r/w r/w r/w r/w por value 0xh 0000xxxx bit name function b7-b4 unimplemented. reads as?? b3 ra3/an3 gpio or analog input. returns value on pin ra3/an3 when used as a digital input. when con?ured as an analog input, reads as ?? b2 ra2/an2 gpio or analog input. returns value on pin ra2/an2 when used as a digital input. when con?ured as an analog input, reads as ?? b1 ra1/an1 gpio or analog input. returns value on ra1/an1 when used as a digital input. this pin can connect to a level shift network. if enabled, a +0.5v offset is added to the input voltage. when con?ured as an analog input, reads as ?? b0 ra0/an0 gpio or analog input. returns value on pin ra0/an0 when used as a digital input. when con?ured as an analog input, reads as ?? 5.2 por tc and trisc portc is a 8-bit wide bidirectional port, with schmitt trigger inputs, that serves the following functions depending on programming: direct led drive (portc<7:0>). ? 2 c communication lines (portc<7:6>), refer to section 7.0 i 2 c serial port. interrupt on change function (portc<7:4>), discussed below and in section 10.3 interrupts. programmable reference and comparator outputs. timer0 clock source on rc3 the portc data register is located at location 07h and its data direction register (trisc) is at 87h. portc<5:0> have weak internal pull-ups (~100 ua typical). a single control bit can turn on all the pull-ups. this is done by clearing bit rcpu (option<7>). the weak pull-up is automatically turned off when the port pin is con?ured as an output. the pull-ups are disabled on power-on reset and in hibernate mode. when using portc<0> as an analog output (cmcon<1> bit is set), the trisc<0> bit should be cleared to disable the weak pull-up on this pin. refer to table 5-1. four of the portc pins, rc<7:4> have an interrupt on change feature. only pins con?ured as inputs can cause this interrupt to occur. in other words, any pin rc<7:4> con?ured as an output is excluded from the interrupt on change comparison. the input pins of rc<7:4> are compared with the old value latched on the last read of portc. the ?ismatch?outputs of rc<7:4> are or?d together to assert the rcif ?g (pir1 register<2>) and cause a cpu interrupt, if enabled. note: if the i 2 c function is enabled, (i 2 ccon<5>, address 14h), rc<7:6> are automatically excluded from the interrupt-on-change comparison.
1996 microchip technology inc. preliminary ds40122b-page 27 pic14000 this interrupt can wake the device up from sleep. the user, in the interrupt service routine, can clear the interrupt in one of two ways: disable the interrupt by clearing the rcie (pie1<2>) bit read portc. this will end mismatch condition. then, clear the rcif (pir1<2>) bit. a mismatch condition will continue to set the rcif bit. reading portc will end the mismatch condition, and allow the rcif bit to be cleared. if bit cmaoe (cmcon<1>) is set, the rc0/refa pin becomes the programmable reference a and analog output. pin rc1/cmpa becomes the comparator a out- put. portc<7:6> also serves multiple functions. these pins act as the i 2 c data and clock lines when the i 2 c module is enabled. they also serve as the serial pro- gramming interface data and clock line for in-circuit programming of the eprom. note: setting cmaoe changes the de?ition of rc0/refa and rc1/cmpa, bypassing the portc data and trisc register set- tings. the trisc register controls the direction of the portc pin. a ? in each location con?ures the corresponding port pin as an input. upon reset, this register sets to ffh, meaning all portc pins are ini- tially inputs. the data register should be initialized prior to con?uring the port as outputs. unused inputs should not be left floating to avoid leakage currents. all pins have input protection diodes to v dd and v ss . example 5-2: initializing portc clrf portc ; initialize portc data ; latches before setting ; the data direction ; register bsf status, rpo ; select bank1 movlw 0xcf ; value used to initialize ; data direction movwf trisc ; set rc<3:0> as inputs ; rc<5:4> as outputs ; rc<7:6> as inputs figure 5-3: block diagram of portc<7:6> pins d q ck q d q ck q d q en data bus write portc write trisc read trisc n i/o pin v dd schmitt trigger input buffer d q en read portc read portc from other portc pins set rcif note: i/o pins have protection diodes to v dd and v ss . these pins do not have a p-channel pull-up. i 2 ccon<5> n v ss
pic14000 ds40122b-page 28 preliminary 1996 microchip technology inc. table 5-1: port rc0 pin configuration summary figure 5-4: block diagram of portc<5:4> pins rc0 pin con?uration trisc<0> rcpu option<7> cmaoe cmcon<1> comment digital input (weak pull-up) 1 0 0 digital input (no pull-up) 1 1 0 digital output 0 x 0 analog output 0 x 1 must clear trisc<0> to disable pull-up when used as an analog output. d q ck q d q ck q d q en data bus write portc write trisc read trisc p i/o pin v dd schmitt trigger input buffer rcpu d q en read portc read portc from other portc pins set rcif 1. i/o pins have protection diodes to v dd and v ss . 2. port latch = ? and trisc = ? enables weak pull-up if rcpu = ? in option register. hibernate
1996 microchip technology inc. preliminary ds40122b-page 29 pic14000 figure 5-5: block diagram of portc<3:0> pins 1. i/o pins have protection diodes to v dd and v ss . 2. port latch =? and trisc =? enables weak pull-up if rcpu =? in option register. 3. if the cmaoe bit (cmcon<1>) is set to?? rc0 becomes refa, rc1 becomes cmpa, ignoring the portc<1:0> data and trisc<1:0> register settings. d q ck q d q ck q data bus write portc write trisc read trisc p i/o pin v dd schmitt trigger input buffer rcpu d q en read portc read portc hibernate
pic14000 ds40122b-page 30 preliminary 1996 microchip technology inc. figure 5-6: portc data register u= unimplemented, x = unknown. 07h bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 portc rc7/sdaa rc6/scla rc5 rc4 rc3/t0cki rc2 rc1/cmpa rc0/refa read/write r/w r/w r/w r/w r/w r/w r/w r/w por value xxh x xxxxxx x bit name function b7 rc7/sdaa synchronous serial data i/o for i 2 c interface. also is the serial programming data line. this pin can also serve as a general purpose i/o. if enabled, a change on this pin can cause a cpu interrupt. this pin has an n-channel pull-up to v dd which is disabled in i 2 c mode. b6 rc6/scla synchronous serial clock for i 2 c interface. also is the serial programming clock. this pin can also serve as a general purpose i/o. if enabled, a change on this pin can cause a cpu interrupt. this pin has an n-channel pull-up to v dd which is disabled in i 2 c mode. b5 rc5 led direct-drive output. this pin can also serve as a gpio. if enabled, a change on this pin can cause a cpu interrupt. if enabled, this pin has a weak internal pull-up to v dd . b4 rc4 led direct-drive output. this pin can also serve as a gpio. if enabled, a change on this pin can cause a cpu interrupt. if enabled, this pin has a weak internal pull-up to v dd . b3 rc3/t0cki led direct-drive output. this pin can also serve as a gpio. if enabled, this pin has a weak internal pull-up to v dd . t0cki is enabled as tmr0 clock via the option register. b2 rc2 led direct-drive output. this pin can also serve as a gpio. if enabled, this pin has a weak internal pull-up to v dd . b1 rc1/cmpa led direct-drive output. this pin can also serve as a gpio, or comparator a output. if enabled, this pin has a weak internal pull-up to v dd . b0 rc0/refa led direct-drive output. this pin can also serve as a gpio, or programmable reference a output. if enabled, this pin has a weak internal pull-up to v dd .
1996 microchip technology inc. preliminary ds40122b-page 31 pic14000 5.2.1 trisc portc data direction register this register de?es each pin of portc as either an input or output under software control. a ? in each location con?ures the corresponding port pin as an input. this register resets to all ?s, meaning all portc pins are initially inputs. the data register should be initialized prior to con?uring the port as outputs. figure 5-7: trisc register u= unimplemented, x = unknown. 87h bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 trisc trisc7 trisc6 trisc5 trisc4 trisc3 trisc2 trisc1 trisc0 read/write r/w r/w r/w r/w r/w r/w r/w r/w por value ffh 1111 1 1 1 1 bit name function b7 trisc7 control direction on pin rc7/sdaa (has no effect if i 2 c is enabled): 0 = pin is an output 1 = pin is an input b6 trisc6 control direction on pin rc6/scla (has no effect if i 2 c is enabled): 0 = pin is an output 1 = pin is an input b5 trisc5 control direction on pin rc5: 0 = pin is an output 1 = pin is an input b4 trisc4 control direction on pin rc4: 0 = pin is an output 1 = pin is an input b3 trisc3 control direction on pin rc3: 0 = pin is an output 1 = pin is an input b2 trisc2 control direction on pin rc2: 0 = pin is an output 1 = pin is an input b1 trisc1 control direction on pin rc1/cmpa (has no effect if the cmaoe bit is set): 0 = pin is an output 1 = pin is an input b0 trisc0 control direction on pin rc0/refa (has no effect if the cmaoe bit is set): 0 = pin is an output 1 = pin is an input
pic14000 ds40122b-page 32 preliminary 1996 microchip technology inc. 5.3 por td and trisd portd is an 8-bit port that may be used for general purpose i/o. four pins can be con?ured as analog inputs. figure 5-8: block diagram of portd<7:4> pins figure 5-9: block diagram of portd<3:2> pins d q ck q d q ck q d q en analog input mode data bus write portd write trisd read trisd read portd to a/d converter note: i/o pins have protection diodes to v dd and v ss . p n i/o pin v ss v dd schmitt trigger input buffer d q ck q d q ck q d q en data bus write portd write trisd read trisd i/o pin read portd read portd 1. i/o pins have protection diodes to vdd and vss. 2. if cmboe (cmcon<5>) is set to ?? rd2 becomes cmpb, rd3 becomes refb, ignoring the portd<3:2> data and trisd<3:2> register settings. schmitt trigger input buffer
1996 microchip technology inc. preliminary ds40122b-page 33 pic14000 figure 5-10: block diagram of portd<1:0> pins figure 5-11: portd data register legend: u = unimplemented, read as ?? x = unknown. 08h bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 portd rd7/an7 rd6/an6 rd5/an5 rd4/an4 rd3/refb rd2/cmpb rd1/sdab rd0/sclb read/write r/w r/w r/w r/w r/w r/w r/w r/w por value xxh xxxx x x x x bit name function b7 rd7/an7 gpio or analog input. returns value on pin rd7/an7 when used as a digital input. when configured as an analog input, reads as ?? b6 rd6/an6 gpio or analog input. returns value on pin rd6/an6 when used as a digital input. when configured as an analog input, reads as ?? b5 rd5/an5 gpio or analog input. this pin can connect to a level shift network. if enabled, a +0.5v offset is added to the input voltage. when con?ured as an analog input, reads as ?? b4 rd4/an4 gpio or analog input. returns value on pin rd4/an4 when used as a digital input. when configured as an analog input, reads as ?? b3 rd3/refb this pin can serve as a gpio, or programmable reference b output. b2 rd2/cmpb this pin can serve as a gpio, or comparator b output. b1 rd1/sdab alternate synchronous serial data i/o for i 2 c interface enabled by setting the i 2 csel bit in the misc register. this pin can also serve as a general purpose i/o. this pin has an n-channel pull-up to vdd which is disabled in i 2 c mode. b0 rd0/sclb alternate synchronous serial clock for i 2 c interface, enabled by setting the i 2 csel bit in the misc register. this pin can also serve as a general pur- pose i/o. this pin has an n-channel pull-up to vdd which is disabled in i 2 c mode. d q ck q d q ck q d q en data bus write portd write trisd read trisd read portd note: i/o pins have protection diodes to v dd and v ss . these pins do not have a p-channel pull-up. n n i/o pin v ss v dd schmitt trigger input buffer i 2 ccon<5>
pic14000 ds40122b-page 34 preliminary 1996 microchip technology inc. figure 5-12: trisd register 88h bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 trisd trisd7 trisd6 trisd5 trisd4 trisd3 trisd2 trisd1 trisd0 read/write r/w r/w r/w r/w r/w r/w r/w r/w por value ffh 1111 1 1 1 1 bit name function b7 trisd7 control direction on pin rd7/an7: 0 = pin is an output 1 = pin is an input b6 trisd6 control direction on pin rd6/an6: 0 = pin is an output 1 = pin is an input b5 trisd5 control direction on pin rd5/an5: 0 = pin is an output 1 = pin is an input b4 trisd4 control direction on pin rd4/an4: 0 = pin is an output 1 = pin is an input b3 trisd3 control direction on pin rd3/refb (has no effect if the cmboe bit is set): 0 = pin is an output 1 = pin is an input b2 trisd2 control direction on pin rd2/cmpb (has no effect if the cmboe bit is set): 0 = pin is an output 1 = pin is an input b1 trisd1 control direction on pin rd1/sdab: 0 = pin is an output 1 = pin is an input b0 trisd0 control direction on pin rd0/sclb: 0 = pin is an output 1 = pin is an input
1996 microchip technology inc. preliminary ds40122b-page 35 pic14000 if the cmboe bit (cmcon<5>) is set, the rd3/refb pin becomes the programmable reference b output and pin rd2/cmpb becomes the comparator b output. portd<1:0> also serve multiple functions. these pins act as the i 2 c data and clock lines when the i 2 c module is enabled. the trisd register controls the direction of the port d pins. a ? in each location con?ures the corresponding port pin as an input. upon reset, this register sets to ffh, meaning all portd pins are ini- tially inputs. the data register should be initialized prior to con?uring the port as outputs. unused inputs should not be left floating to avoid leakage currents. all pins have input protection diodes to v dd and v ss . example 5-3: initializing portd note: setting cmboe changes the de?ition of rd3/refb and rd2/cmpb, bypassing the portd data and trisd register set- tings. clrf portd ; initialize portd data ; latches before setting ; the data direction ; register bsf status, rp0 ; select bank1 movlw 0xff ; value used to initialize ; data direction movwf trisd ; set rd<7:0> as inputs 5.4 i/o pr ogramming considerations 5.4.1 bi-directional i/o ports reading the port register reads the values of the port pins. writing to the port register writes the value to the port latch. some instructions operate internally as read-modify-write. the bcf and bsf instructions, for example, read the register into the cpu, execute the bit operation, and write the result back to the register. caution must be used when these instructions are applied to a port with both inputs and outputs de?ed. for example, a bsf operation on bit5 of portc will cause all eight bits of portc to be read into the cpu. then the bsf operation takes place on bit5 and portc is written to the output latches. if another bit of portc is used as a bi-directional i/o pin (say bit0) and it is de?ed as an input at this time, the input signal present on the pin itself would be read into the cpu and re-written to the data latch of this particular pin, overwriting the previous content. as long as the pin stays in the input mode, no problem occurs. however, if bit0 is switched into output mode later on, the content of the data latch may now be unknown. a pin actively outputting a low or high should not be driven from external devices at the same time in order to change the level on this pin (?ire-or? ?ire-and?. the resulting high output currents may damage the chip. example 5-4 shows the effect of two sequential read modify write instructions (ex. bcf, bsf , etc.) on an i/o port. example 5-4: read modify write instructions on an i/o port ; ; initial port settings: portc<7:4> inputs ; portc<3:0> outputs ; ; portc<7:6> have external pull-up and are not connected to other circuitry ; ; port latch port pins ; ---------- ---------- bcf portc, 7 ; 01pp pppp 11pp pppp bcf portc, 6 ; 10pp pppp 11pp pppp bsf status,rp0 ; bcf trisc, 7 ; 10pp pppp 11pp pppp bcf trisc, 6 ; 10pp pppp 10pp pppp ; ; note that the user may have expected the pin ; values to be 00pp pppp. the 2nd bcf caused ; rc7 to be latched as the pin value (high).
pic14000 ds40122b-page 36 preliminary 1996 microchip technology inc. 5.4.2 successive operations on i/o ports the actual write to an i/o port happens at the end of an instruction cycle, whereas for reading, the data must be valid at the beginning of the instruction cycle. therefore, care must be exercised if a write operation is followed by a read operation on the same i/o port. the sequence of instructions should be such to allow the pin voltage to stabilize before the next instruction which causes that port to be read into the cpu is executed. otherwise, the previous state of that pin may be read into the cpu rather than the new state. when in doubt, it is better to separate these instructions with a nop or another instruction not accessing this i/o port. figure 5-13: successive i/o operation q1 | q2 | q3 | q4 pc pc + 2 pc + 1 pc + 3 movwf portc write to portc movf portc, w read portc nop nop rc port pin sampled here execute movwf portc pin values execute movf portc, w execute nop example showing write to portc followed by immediate read. some delays in settling may cause ?ld port data to be read, especially at higher clock frequencies. data setup time = (0.25 tcyc- tpd), where tcyc = instruction cycle time. q1 | q2 | q3 | q4 q1 | q2 | q3 | q4 q1 | q2 | q3 | q4
1996 microchip technology inc. preliminary ds40122b-page 37 pic14000 6.0 timer modules the pic14000 contains two general purpose timer modules, timer0 (tmr0) and the watchdog timer (wdt). the adtmr is described in the a/d section. the timer0 module is identical to the timer0 module of the pic16c7x enhanced core products. it is an 8-bit over?w counter. the timer0 module has a programmable prescaler option. this prescaler can be assigned to either the timer0 module or the watchdog timer (wdt). psa (option<3>) assigns the prescaler, and ps2:ps0 (option<2:0>) determines the prescaler value. timer0 can increment at the following rates: 1:1 (when prescaler assigned to watchdog timer), 1:2, 1:4, 1:8, 1:16, 1:32, 1:64, 1:128, 1:256. the timer0 module has the following features: 8-bit timer readable and writable (?e address 01h) 8-bit software programmable prescaler interrupt on over?w from ffh to 00h figure 6-1 is a simpli?d block diagram of the timer0 module. the timer0 module will increment every instruction cycle (without prescaler). if tmr0 is written, increment is inhibited for the following two cycles (figure 6-2 and figure 6-3). the user can compensate by writing an adjusted value to tmr0. figure 6-1: timer0 and watchdog timer block diagram rc3/t0cki t0se 0 1 1 0 pin t0cs f osc /4 sync with internal clocks tmr0 psout (2 cycle delay) psout data bus 8 psa set t0if interrupt on over?w 8-bit counter 8-to-1 mux 18 ms timer psa 0 1 wdt time-out ps2:ps0 8 note: t0cs, t0se, psa, ps2:ps0 correspond to (option<5:0>). psa 0 1 3 hibernate wdt enable bit local oscillator prescaler/ postscaler enable watchdog timer timer0 this document was created with framemake r404
pic14000 ds40122b-page 38 preliminary 1996 microchip technology inc. 6.1 timer0 interrupt the tmr0 interrupt is generated when the timer0 over?ws from ffh to 00h. this over?w sets the t0if bit. the interrupt can be masked by clearing bit t0ie (intcon<5>). flag bit t0if (intcon<2>) must be cleared in software by the tmr0 module interrupt ser- vice routine before re-enabling this interrupt. the timer0 module interrupt cannot wake the processor from sleep since the timer is shut off during sleep. the timing of the timer0 interrupt is shown in figure 6-4. figure 6-2: timer0 timing: internal clock/no prescale figure 6-3: timer0 timing: internal clock/prescale 1:2 figure 6-4: timer0 interrupt timing pc-1 q1 q2 q3 q4 q1 q2 q3 q4 q1 q2 q3 q4 q1 q2 q3 q4 q1 q2 q3 q4 q1 q2 q3 q4 q1 q2 q3 q4 q1 q2 q3 q4 pc (program counter) instruction fetch tmr0 pc pc+1 pc+2 pc+3 pc+4 pc+5 pc+6 t0 t0+1 t0+2 nt0 nt0 nt0 nt0+1 nt0+2 movwf tmr0 movf tmr0,w movf tmr0,w movf tmr0,w movf tmr0,w movf tmr0,w write tmr0 executed read tmr0 reads nt0 read tmr0 reads nt0 read tmr0 reads nt0 read tmr0 reads nt0 + 1 read tmr0 reads nt0 + 2 instruction executed pc-1 q1 q2 q3 q4 q1 q2 q3 q4 q1 q2 q3 q4 q1 q2 q3 q4 q1 q2 q3 q4 q1 q2 q3 q4 q1 q2 q3 q4 q1 q2 q3 q4 pc (program counter) instruction fetch tmr0 pc pc+1 pc+2 pc+3 pc+4 pc+5 pc+6 t0 nt0+1 movwf tmr0 movf tmr0,w movf tmr0,w movf tmr0,w movf tmr0,w movf tmr0,w write tmr0 executed read tmr0 reads nt0 read tmr0 reads nt0 read tmr0 reads nt0 read tmr0 reads nt0 read tmr0 reads nt0 + 1 t0+1 nt0 instruction execute q2 q1 q3 q4 q2 q1 q3 q4 q2 q1 q3 q4 q2 q1 q3 q4 q2 q1 q3 q4 1 1 osc1 clkout(3) tmr0 timer t0if bit (intcon<2>) feh gie bit (intcon<7>) instruction flow pc instruction fetched pc pc +1 pc +1 0004h 0005h instruction executed inst (pc) inst (pc-1) inst (pc+1) inst (pc) inst (0004h) inst (0005h) inst (0004h) dummy cycle dummy cycle ffh 00h 01h 02h note 1: t0if interrupt ?g is sampled here (every q1). 2: interrupt latency = 4tcy where tcy = instruction cycle time. 3: clkout is available only in hs oscillator mode.
1996 microchip technology inc. preliminary ds40122b-page 39 pic14000 6.2 using timer0 with external cloc k when the external clock input (pin rc3/t0cki) is used for timer0, it must meet certain requirements. the external clock requirement is due to internal phase clock (t osc ) synchronization. also, there is a delay in the actual incrementing of tmr0 after synchronization. 6.2.1 external clock synchronization when no prescaler is used, the external clock input is the same as the prescaler output. the synchronization of t0cki with the internal phase clocks is accomplished by sampling the prescaler output on the q2 and q4 cycles of the internal phase clocks (figure 6-5). therefore, it is necessary for t0cki to be high for at least 2tosc (and a small rc delay of 20 ns) and low for at least 2tosc (and a small rc delay of 20 ns). when a prescaler is used, the external clock input is divided by the asynchronous ripple counter-type prescaler so that the prescaler output is symmetrical. for the external clock to meet the sampling requirement, the ripple counter must be taken into account. therefore, it is necessary for t0cki to have a period of at least 4tosc (and a small rc delay of 40 ns) divided by the prescaler value. the only requirement on t0cki high and low time is that they do not violate the minimum pulse width requirement of 10 ns. 6.2.2 timer0 increment delay since the prescaler output is synchronized with the internal clocks, there is a small delay from the time the external clock edge occurs to the time the timer0 module is actually incremented. figure 6-5 shows the delay from the external clock edge to the timer incrementing. 6.3 prescaler an 8-bit counter is available as a prescaler for the timer0 module, or as a post-scaler for the watchdog timer (figure 6-1). for simplicity, this counter is being referred to as ?rescaler?throughout this data sheet. note that there is only one prescaler available which is mutually exclusive between the timer0 module and the watchdog timer. thus, a prescaler assignment for the timer0 module means that there is no prescaler for the watchdog timer, and vice-versa. bit psa and ps2:ps0 (option<3:0>) determine the prescaler assignment and prescale ratio. when assigned to the timer0 module, all instructions writing to the timer0 module (e.g., clrf 1, movwf 1, bsf 1,x ) will clear the prescaler. when assigned to wdt, a clrwdt instruction will clear the prescaler along with the watchdog timer. the prescaler is not readable or writable. figure 6-5: timer0 timing with external clock increment tmr0 (q4) ext clock input or q1 q2 q3 q4 q1 q2 q3 q4 q1 q2 q3 q4 q1 q2 q3 q4 tmr0 t0 t0 + 1 t0 + 2 small pulse misses sampling ext clock/prescaler output after sampling (note 3) 1. 2. 3. delay from clock input change to tmr0 increment is 3 t osc to 7 t osc . (duration of q = t osc ). therefore, the error in measuring the interval between two edges on tmr0 input = 4 tosc max. external clock if no prescaler selected, prescaler output otherwise. the arrows indicate the points in time where sampling occurs. notes: prescaler out (note 2)
pic14000 ds40122b-page 40 preliminary 1996 microchip technology inc. 6.3.1 switching prescaler assignment the prescaler assignment is fully under software control, i.e., it can be changed ?n the ??during program execution. to avoid an unintended device reset, the following instruction sequence (example 6-1) must be executed when changing the prescaler assignment from timer0 to wdt. example 6-1: changing prescaler (timer0 ? wdt) 1.bcf status,rp0 ;skip if already in ; bank 0 2.clrwdt ;clear wdt 3.clrf tmr0 ;clear tmr0 & prescaler 4.bsf status, rp0 ;bank 1 5.movlw '00101111'b; these 3 lines (5, 6, 7) 6.movwf option ; are required only ; if desired ps<2:0> 7.clrwdt ; are 000 or 001 8.movlw '00101xxx'b ;set postscaler to 9.movwf option ; desired wdt rate 10.bcf status, rp0 ;return to bank 0 to change prescaler from the wdt to the timer0 module use the sequence shown in example 6-2. this precaution must be taken even if the wdt is disabled. example 6-2: changing prescaler (wdt ? timer0) clrwdt ;clear wdt and ;prescaler bsf status, rp0 movlw b'xxxx0xxx' ;select tmr0, new ;prescale value and ;clock source movwf option bcf status, rp0 table 6-1: summary of timer0 registers table 6-2: registers associated with timer0 register name function address power-on reset value tmr0 timer/counter register 01h xxxx xxxx option con?uration and prescaler assign- ment bits for tmr0. 81h 1111 1111 intcon tmr0 over?w interrupt ?g and mask bits. 0bh 0000 000x legend: x = unknown, note 1: for reset values of registers in other reset situations refer to table 10-4. address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 01h tmr0 timer0 timer/counter 0bh/8bh intcon gie peie t0ie r r t0if r r 81h option rcpu r t0cs t0se psa ps2 ps1 ps0 87h trisc trisc7 trisc6 trisc5 trisc4 trisc3 trisc2 trisc1 trisc0 legend: r = reserved locations shaded boxes are not used by timer0 module
1996 microchip technology inc. preliminary ds40122b-page 41 pic14000 7.0 inter-integrated circuit serial port (i 2 c ) the i 2 c module is a serial interface useful for communicating with other peripheral or microcontroller devices. these peripheral devices may be serial eeproms, shift registers, display drivers, a/d converters, etc. the i 2 c module is compatible with the following interface speci?ations: inter-integrated circuit (i 2 c) system management bus (smbus) this section provides an overview of the inter-ic(i 2 c) bus. the i 2 c bus is a two-wire serial interface developed by the philips corporation. the original speci?ation, or standard mode, was for data transfers of up to 100 kbps. an enhanced speci?ation, or fast mode, supports data transmission up to 400 kbps. both standard mode and fast mode devices will inter-operate if attached to the same bus. the i 2 c interface employs a comprehensive protocol to ensure reliable transmission and reception of data. when transmitting data, one device is the ?aster (generates the clock) while the other device(s) acts as the ?lave? all portions of the slave protocol are implemented in the i 2 c modules hardware, except general call support, while portions of the master proto- col will need to be addressed in the pic14000 soft- ware. table 7-1 de?es some of the i 2 c bus terminology. for additional information on the i 2 c inter- face speci?ation, please refer to the philips corpora- tion document ?he i 2 c-bus and how to use it? note: the i 2 c module on pic14000 only supports i 2 c mode. this is different from the standard module used on the pic16c7x family, which supports both i 2 c and spi modes. caution should be exercised to avoid enabling spi mode on the pic14000. in the i 2 c interface protocol each device has an address. when a master wishes to initiate a data transfer, it ?st transmits the address of the device that it wishes to talk to. all devices ?isten?to see if this is their address. within this address, a bit speci?s if the master wishes to read from or write to the slave device. the master and slave are always in opposite modes (transmitter/receiver) of operation during a data transfer. they may operate in either of these two states: master-transmitter and slave-receiver slave-transmitter and master-receiver in both cases the master generates the clock signal. the output stages of the clock (scl) and data (sda) lines must have an open-drain or open-collector in order to perform the wired-and function of the bus. external pull-up resistors are used to ensure a high level when no device is pulling the line down. the number of devices that may be attached to the i 2 c bus is limited only by the maximum bus loading speci?a- tion of 400 pf. 7.1 initiating and t erminating data t ransf er during times of no data transfer (idle time), both the clock line (scl) and the data line (sda) are pulled high through the external pull-up resistors. the start and stop determine the start and stop of data transmission. the start is de?ed as a high to low transition of sda when scl is high. the stop is de?ed as a low to high transition of sda when scl is high. figure 7-1 shows the start and stop. the master generates these conditions for starting and ter- minating data transfer. due to the de?ition of the start and stop, when data is being transmitted the sda line can only change state when the scl line is low. figure 7-1: i 2 c start and stop conditions s start condition change of data allowed change of data allowed stop condition p sda scl this document was created with framemake r404
pic14000 ds40122b-page 42 preliminary 1996 microchip technology inc. figure 7-2: i 2 cstat: i 2 c port status register bf: buffer full receive 1 = receive complete, i 2 cbuf is full 0 = receive not complete, i 2 cbuf is empty t ransmit 1 = transmit in progress, i 2 cbuf is full 0 = transmit complete, i 2 cbuf is empty ua: update address (10-bit i 2 c slave mode only) 1 = indicate that the user needs to update the address in the i 2 cadd register. 0 = address does not need to be updated r/ w : read/write bit information this bit holds the r/w bit information received following the last address match. this bit is only valid during the transmission. the user may use this bit in software to determine whether transmission or reception is in progress. 1 = read 0 = write s: start bit this bit is cleared when the i 2 c module is disabled (i 2 cen is cleared) 1 = indicates that a start bit has been detected last. this bit is 0 on reset. 0 = start bit was not detected last p: stop bit this bit is cleared when the i 2 c module is disabled (i 2 cen is cleared) 1 = indicates that a stop bit has been detected last. 0 = stop bit was not detected last d/ a : data/address bit 1 = indicates that the last byte received was data 0 = indicates that the last byte received was address unimplemented: read as ? u _ bit0 bit7 register: i 2 cstat w: writable bit r s u _ r d/a r p r r/w r ua r bf r: readable bit u: unimplemented, read as ? address: 94h por value: 00h
1996 microchip technology inc. preliminary ds40122b-page 43 pic14000 figure 7-3: i 2 ccon: i 2 c port control register i 2 cm<3:0>: i 2 c mode select 0110 = i 2 c slave mode, 7-bit address 0111 = i 2 c slave mode, 10-bit address 1011 = i 2 c ?mware controlled master mode (slave idle) 1110 = i 2 c slave mode, 7-bit address with start and stop bit interrupts enabled 1111 = i 2 c slave mode, 10-bit address with start and stop bit interrupts enabled ckp: clock polarity select sck release control 1 = enable clock 0 = holds clock low (clock stretch) note: used to ensure data setup time i 2 cen: i 2 c enable 1 = enables the serial port and congures sda and scl pins as serial port pins. when enabled, these pins must be congured as input 0 = disables serial port and congures these pins as i/o port pins i 2 cov: receive over?w ?g 1 = a byte is received while the i 2 cbuf is still holding the previous byte. i 2 cov is a don't care in transmit mode. i 2 cov must be cleared in software. wcol: write collision detect 1 = the i 2 cbuf register is written while it is still transmitting the previ- ous word. must be cleared in software. 0 = no collision bit0 bit7 r/w i 2 cm3 r/w i 2 cen r/w ckp r/w i 2 cm2 r/w i 2 cm1 r/w i 2 cm0 r/w i 2 cov r/w wcol register: i 2 ccon w: writable bit r: readable bit u: unimplemented, read as ? address: 14h por value: 00h any other combinations of i 2 cm<3:0> are illegal and should never be used. or output. 0 = no over?w
pic14000 ds40122b-page 44 preliminary 1996 microchip technology inc. table 7-1: i 2 c bus terminology term description transmitter the device that sends the data to the bus. receiver the device that receives the data from the bus. master the device which initiates the transfer, generates the clock, and terminates the transfer. slave the device addressed by a master. multi-master more than one master device in a system. these masters can attempt to control the bus at the same time without corrupting the message. arbitration procedure that ensures that only one of the master devices will control the bus. this ensures that the transfer data does not get corrupted. synchronization procedure where the clock signals of two or more devices are synchronized. figure 7-4: i 2 c 7-bit address format figure 7-5: i 2 c 10-bit address format s r/w ack sent by slave slave address s r/w read/write pulse msb lsb start condition ack acknowledge sent by slave = 0 for write s1 s r/w ack 1 1 1 0 a9 a8 rw ack a7 a6 a5 a4 a3 a2 a1 a0 ack - - - start condition read/write pulse acknowledge 7.2 ad dressing i 2 c de vices there are two address formats. the simplest is the 7-bit address format with a r/w bit (figure 7-4). the address is the most signi?ant seven bits of the byte. for example when loading the i 2 cadd register, the least signi?ant bit is a ?on? care? the more complex is the 10-bit address with a r/w bit (figure 7-5). for 10-bit address format, two bytes must be transmitted with the ?st ?e bits specifying this to be a 10-bit address.
1996 microchip technology inc. preliminary ds40122b-page 45 pic14000 7.3 t ransf er ac kno wledg e all data must be transmitted per byte, with no limit to the number of bytes transmitted per data transfer. after each byte, the slave-receiver generates an acknowledge bit (ack ). this is shown in figure 7-6. when a slave-receiver doesn? acknowledge the slave address or received data, the master must abort the transfer. the slave must leave sda high so that the master can generate the stop (figure 7-1). if the master is receiving the data (master-receiver), it generates an acknowledge signal for each received byte of data, except for the last byte. to signal the end of data to the slave-transmitter, the master does not generate an acknowledge. the slave then releases the sda line so the master can generate the stop. the master can also generate the stop during the acknowledge pulse for valid termination of data transfer. if the slave needs to delay the transmission of the next byte, holding the scl line low will force the master into a wait state. data transfer continues when the slave releases the scl line. this allows the slave to move the received data or fetch the data it needs to transfer before allowing the clock to start. this wait state can be accomplished by setting smhog (misc<7>) high. clearing misc<7> will resume the data transfer. figure 7-7 shows a data transfer waveform. figure 7-8 and figure 7-9 show master-transmitter and master-receiver data transfer sequences. figure 7-6: i 2 c slave-receiver acknowledge data output by transmitter data output by receiver scl from master s start condition not acknowledge acknowledge 12 89 clock pulse for acknowledgement figure 7-7: sample i 2 c data transfer address r/w ack wait state data ack stop condition p 9 3 ?8 2 acknowledgement signal from receiver 1 byte complete. interrupt with receiver 2 1 9 7 8 acknowledgement signal from receiver msb sda scl start condition s clock line held low while interrupts are serviced
pic14000 ds40122b-page 46 preliminary 1996 microchip technology inc. when a master does not wish to relinquish the bus (by generating a stop condition), a repeated start (sr) must be generated. this condition is identical to the start (sda goes high-to-low while scl is high), but occurs after a data transfer acknowledge pulse (not the bus-free state). this allows a master to send ?ommands?to the slave and then receive the requested information or to address a different slave device. this sequence is shown in figure 7-10. figure 7-8: master - transmitter sequence figure 7-9: master - receiver sequence figure 7-10: combined format for 7-bit address: s slave address r/w a data a data a/a p "0" (write) data transferred (n bytes - acknowledge) a master transmitter addresses a slave receiver with a 7-bit address. the transfer direction is not changed. for 10-bit address: s slave address first 7 bits r/w a1 slave address second byte a2 (write) a master transmitter addresses a slave receiver with a 10-bit address. from master to slave from slave to master a = acknowledge (sda low) a = not acknowledge (sda high) s = start condition p = stop condition data a data p a/a for 7-bit address: s slave address r/w a data a data a p (read) data transferred (n bytes - acknowledge) a master reads a slave immediately after the first byte. for 10-bit address: s slave address first 7 bits r/w a1 slave address second byte a2 (write) a master transmitter addresses a slave receiver with a 10-bit address. from master to slave from slave to master a = acknowledge (sda low) a = not acknowledge (sda high) s = start condition p = stop condition sr slave address first 7 bits r/w a3 data a data p a (read) s slave address r/w a data a/a (read or write) (n bytes + acknowledge) transfer direction of data and acknowledgement bits depends on r/w bits. combined format: s slave address first 7 bits r/w a slave address second byte a (write) combined format - from master to slave from slave to master a = acknowledge (sda low) a = not acknowledge (sda high) s = start condition p = stop condition sr slave address first 7 bits r/w a data a data p a (read) sr slave address r/w a data a/a p sr = repeated start condition direction of transfer may change at this point data a data a/a a master addresses a slave with a 10-bit address, then transmits data to this slave and reads data from this slave. (read) (write)
1996 microchip technology inc. preliminary ds40122b-page 47 pic14000 7.4 multi-master operation the i 2 c protocol allows a system to have more than one master. this is called multi-master. when two or more masters try to transfer data at the same time, arbitration and synchronization occur. 7.4.1 arbitration arbitration takes place on the sda line, while the scl line is high. the master which transmits a high when the other master transmits a low loses arbitration (figure 7-11) and turns off its data output stage. a master which lost arbitrating can generate clock pulses until the end of the data byte where it lost arbitration. when the master devices are addressing the same device, arbitration continues into the data. masters that also incorporate the slave function, and have lost arbitration must immediately switch over to slave-receiver mode. this is because the winning master-transmitter may be addressing it. arbitration is not allowed between: a repeated start a stop and a data bit a repeated start and a stop care needs to be taken to ensure that these conditions do not occur. 7.4.2 clock synchronization clock synchronization occurs after the devices have started arbitration. this is performed using a wired-and connection to the scl line. a high to low transition on the scl line causes the concerned devices to start counting off their low period. once a device clock has gone low, it will hold the scl line low until its scl high state is reached. the low to high transition of this clock may not change the state of the scl line, if another device clock is still within its low period. the scl line is held low by the device with the longest low period. devices with shorter low periods enter a high wait-state, until the scl line comes high. when the scl line comes high, all devices start counting off their high periods. the ?st device to complete its high period will pull the scl line low. the sca line high time is determined by the device with the shortest high period. this is shown in the figure 7-12. figure 7-11: multi-master arbitration (2 masters) figure 7-12: i 2 c clock synchronization transmitter 1 loses arbitration data 1 sda data 1 data 2 sda scl wait state start counting high period clk 1 clk 2 scl counter reset
pic14000 ds40122b-page 48 preliminary 1996 microchip technology inc. figure 7-13: i 2 c block diagram read write internal data bus rc7/sdaa i 2 csr i 2 cbuf msb match detect start and rc6/scla i 2 cadd stop bit detect addr_match set, reset s, p bits (i 2 cstat reg) shift clock rd1/sdab rd0/sclb 4:2 mux sck sda misc<4> 7.5 i 2 c operation the i 2 c module in i 2 c mode fully implements all slave functions, and provides support in hardware to facilitate software implementations of the master functions. the i 2 c module implements the standard and fast mode speci?ations as well as 7-bit and 10-bit addressing. two pins are used for data transfer. these are the rc6/scla pin, which is the i 2 c clock, and the rc7/sdaa pin which acts as the i 2 c data. the i 2 c module can also be accessed via the rd0/sclb and rd1/sdab pins by setting i 2 csel (misc<4>).the user must con?ure these pins as inputs or outputs through the trisc<7:6> or trisd<1:0> bits. a block diagram of the i 2 c module in i 2 c mode is shown in figure 7-13. the i 2 c module functions are enabled by setting the i 2 ccon<5> bit. the i 2 c module has ?e registers for i 2 c operation. these are the: ? 2 c control register (i 2 ccon) ? 2 c status register (i 2 cstat) serial receive/transmit buffer (i 2 cbuf) ? 2 c shift register (i 2 csr) - not directly accessible address register (i 2 cadd) the i 2 ccon register (14h) allows control of the i 2 c operation. four mode selection bits (i 2 ccon<3:0>) allow one of the following i 2 c modes to be selected: ? 2 c slave mode (7-bit address) ? 2 c slave mode (10-bit address) ? 2 c slave mode (7-bit address), with start and stop bit interrupts enabled ? 2 c slave mode (10-bit address), with start and stop bit interrupts enabled ? 2 c firmware controlled master mode, slave is idle selection of any i 2 c mode with the i 2 cen bit set, forces the scl and sda pins to be open collector, provided these pins are set to inputs through the trisc bits. the i 2 cstat register gives the status of the data transfer. this information includes detection of a start or stop bit, speci?s if the received byte was data or address, if the next byte is the completion of 10-bit address, and if this will be a read or write data transfer. the i 2 cstat register is read only. the i 2 cbuf is the register to which transfer data is written to or read from. the i 2 csr register shifts the data in or out of the device. in receive operations, the i 2 cbuf and i 2 csr create a double buffered receiver. this allows reception of the next byte before reading the last byte of received data. when the complete byte is received, it is transferred to the i 2 cbuf and pir1<3> is set. if another complete byte is received before the i 2 cbuf is read, a receiver over?w has occurred and the i 2 ccon<6> is set. the i 2 cadd register holds the slave address. in 10-bit mode, the user needs to write the high byte of the address (1 1 1 1 0 a9 a8 0). following the high byte address match, the low byte of the address needs to be loaded (a7-a0).
1996 microchip technology inc. preliminary ds40122b-page 49 pic14000 7.5.1 slave mode in slave mode, the sclx and sdax pins must be con?ured as inputs (trisc<7:6> or trisd<1:0> are set). the i 2 c module will override the input state with the output data when required (slave-transmitter). when an address is matched or the data transfer from an address match is received, the hardware automatically will generate the acknowledge (ack ) pulse, and then load the i 2 cbuf with the received value in the i 2 csr. there are two conditions that will cause the i 2 c module not to give this ack pulse. these are if either (or both) occur: the buffer full (bf), i 2 cstat<0>, bit was set before the transfer was received, or the over?w (i 2 cov), i 2 ccon<6> bit was set before the transfer was received. in this case, the i 2 csr value is not loaded into the i 2 cbuf, but the i 2 cif bit is set. table 7-2 shows what happens when a data transfer byte is received, given the status of the bf and i 2 cov bits. the shaded boxes show the conditions where user software did not properly clear the over?w condition. the bf ?g is cleared by reading the i 2 cbuf register while the i 2 cov bit is cleared through software. the scl clock input must have a minimum high and low for proper operation. the high and low times of the i 2 c speci?ation as well as the requirement of the i 2 c module is shown in the ac timing speci?ations. table 7-2: data transfer received byte actions status bits as data transfer is received bf i 2 cov i 2 csr-> i 2 cbuf generate a ck pulse set i 2 cif bit (i 2 c interrupt if enabled) 0 0 yes yes yes 1 0 no no yes 1 1 no no yes 0 1 no no yes
pic14000 ds40122b-page 50 preliminary 1996 microchip technology inc. 7.5.1.1 addressing once the i 2 c module has been enabled, the i 2 c waits for a start to occur. following the start, the 8-bits are shifted into the i 2 csr. all incoming bits are sampled with the rising edge of the clock (scl) line. the i 2 csr<7:1> is compared to the i 2 cadd register. the address is compared on the falling edge of the eighth clock (scl) pulse. if the addresses match, and the bf and i 2 cov bits are clear, the following things happen: ?i 2 csr loaded into i 2 cbuf buffer full (bf) bit is set ack pulse is generated ?i 2 c interrupt flag (i 2 cif) is set (interrupt is generated if enabled (i 2 cie set) on falling edge of ninth scl pulse. in 10-bit address mode, two address bytes need to be received by the slave (figure 7-5). the ?e most signi?ant bits (msbs) of the ?st address byte specify if this is a 10-bit address. the r/w bit (bit 0) must specify a write, so the slave device will received the second address byte. for a 10-bit address the ?st byte would equal ? 1 1 1 0 a9 a8 0? where a9 and a8 are the two msbs of the address. the sequence of events for 10-bit address are as follows, with steps 7-9 for slave-transmitter: 1. receive ?st (high) byte of address (i 2 cif, bf and ua are set). 2. update i 2 cadd with second (low) byte of address (clears ua and releases scl line). 3. read i 2 cbuf (clears bf) and clear i 2 cif. 4. receive second (low) byte of address (i 2 cif, bf and ua are set). 5. update i 2 cadd with ?st (high) byte of address (clears ua, if match releases scl line). 6. read i 2 cbuf (clears bf) and clear i 2 cif 7. receive repeated start. 8. receive ?st (high) byte of address (i 2 cif and bf are set). 9. read i 2 cbuf (clears bf) and clear i 2 cif. 7.5.1.2 reception when the r/w bit of the address byte is clear and an address match occurs, the r/w bit of the i 2 cstat register is cleared. the received address is loaded into the i 2 cbuf. when the address byte over?w condition exists then no acknowledge (ack ) pulse is given. an over?w condition is de?ed as either the bf bit (i 2 cstat<0>) is set or the i 2 cov bit (i 2 ccon<6>) is set (figure 7-14). an i 2 cif interrupt is generated for each data transfer byte. the i 2 cif bit must be cleared in software, and the i 2 cstat register is used to determine the status of the byte. in master mode with slave enabled, three inter- rupt sources are possible. reading bf, p and s will indicate the source of the interrupt. caution: bf is set after receipt of eight bits and auto- matically cleared after the i 2 cbuf is read. however, the ?g is not actually cleared until receipt of the acknowledge pulse. oth- erwise extra reads appear to be valid. figure 7-14: i 2 c waveforms for reception (7-bit address) p 9 8 7 6 5 d0 d1 d2 d3 d4 d5 d6 d7 s a7 a6 a5 a4 a3 a2 a1 sda scl 12 3 4 5 6 7 8 9 12 3 4 56 7 89 123 4 bus master terminates transfer i 2 cov is set because i 2 cbuf is cleared in software i 2 cbuf is read ack receiving data receiving data d0 d1 d2 d3 d4 d5 d6 d7 ack receiving address i 2 cif (pir1<3>) bf (i 2 cstat<0>) i 2 cov (i 2 ccon<6>) ack r/w =0 still full. ack is not sent.
1996 microchip technology inc. preliminary ds40122b-page 51 pic14000 7.5.1.3 transmission when the r/w bit of the address byte is set and an address match occurs, the r/w bit of the i 2 cstat register is set. the received address is loaded into the i 2 cbuf the ack pulse will be sent on the ninth bit, and the scl pin is held low. the transmit data must be loaded into the i 2 cbuf register, which also loads the i 2 csr register. then the scl pin should be enabled by setting the ckp bit (i 2 ccon<4>). the eight data bits are shifted out on the falling edge of the scl input. this ensures that the sda signal is valid during the scl high time (figure 7-15). a i 2 cif interrupt is generated for each data transfer byte. the i 2 cif bit must be cleared in software, and the i 2 cstat register is used to determine the status of the byte. the i 2 cif bit is set on the falling edge of the ninth clock pulse. as a slave-transmitter, the ack pulse from the master-receiver is latched on the rising edge of the ninth scl input pulse. if the sda line was high (not ack ), then the data transfer is complete. the slave then monitors for another occurrence of the start bit. if the sda line was low (ack ), the transmit data must be loaded into the i 2 cbuf register, which also loads the i 2 csr register. then the scl pin should be enabled by setting the ckp bit (i 2 ccon<4>). figure 7-15: i 2 c waveforms for transmission (7-bit address) sda scl i 2 cif (pir1<3>) bf (i 2 cstat<0>) ckp (i 2 ccon<4>) a7 a6 a5 a4 a3 a2 a1 ack d7 d6 d5 d4 d3 d2 d1 d0 ack transmitting data r/w = 1 receiving address 123456789 123456789 p cleared in software i 2 cbuf is written in software from i 2 cif interrupt service routine set bit after writing to i 2 cbuf s data in sampled scl held low while cpu responds to i 2 cif
pic14000 ds40122b-page 52 preliminary 1996 microchip technology inc. 7.5.2 master mode master mode operation is supported by interrupt generation on the detection of the start and stop. the stop(p) and start(s) bits are cleared from a reset or when the i 2 c module is disabled. control of the i 2 c bus may be taken when the p bit is set, or the bus is idle and both the s and p bits are cleared. in master mode, the scl and sda lines are manipulated by changing the corresponding trisc<7:6> or trisd<1:0> bits to an output (cleared). the output level is always low, regardless of the value(s) in portc<7:6> or portd<1:0>. so when transmitting data, a ??data bit must have the trisc<7> or trisd<1> bit set (input) and a ??data bit must have the trisc<7> or trisd<1> bit cleared (output). the same scenario is true for the scl line with the trisc<6> or trisd<0> bit. the following events will cause the i 2 c interrupt flag (i 2 cif) to be set (i 2 c interrupt if enabled): ?tart ?top data transfer byte transmitted/received master mode of operation can be done with either the slave mode idle (i 2 cm3...i 2 cm0 = 1011b) or with the slave active. when both master and slave modes are enabled, the software needs to differentiate the source(s) of the interrupt. 7.5.3 multi-master mode in multi-master mode, the interrupt generation on the detection of the start and stop allows the determination of when the bus is free. the stop (p) and start (s) bits are cleared from a reset or when the i 2 c module is disabled. control of the i 2 c bus may be taken when the p bit is set, or the bus is idle and both the s and p bits are cleared. when the bus is busy, enabling the i 2 c interrupt will generate the interrupt when the stop occurs. in multi-master operation, the sda line must be monitored to see if the signal level is the expected output level. this check only needs to be done when a high level is output. if a high level is expected and low level is present, the device needs to release the sda and scl lines (set trisc<7:6>). there are two stages where this arbitration can be lost, these are: address transfer data transfer when the slave logic is enabled, the slave continues to receive. if arbitration was lost during the address transfer stage, the device may being addressed. if addressed an ack pulse will be generated. if arbitration was lost during the data transfer stage, the device will need to re-transfer the data at a later time. table 7-3: registers associated with i 2 c operation address name bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 0b/8bh intcon gie peie t0ie r r t0if r r 0ch pir1 cmif pbif i 2 cif rcif adcif ovfif 8ch pie1 cmie pbie i 2 cie rcie adcie ovfie 13h i 2 cbuf i 2 c serial port receive buffer/transmit register 93h i 2 cadd i 2 c mode synchronous serial port (i 2 c mode) address register 14h i 2 ccon wcol i 2 con i 2 cen ckp i 2 cm3 i 2 cm2 i 2 cm1 i 2 cm0 94h i 2 cstat d/a p s r/w ua bf 9eh misc smhog spgndb spgnda i 2 csel smbus inclken osc2 osc1 87h trisc trisc7 trisc6 trisc5 trisc4 trisc3 trisc2 trisc1 trisc0 88h trisd trisd7 trisd6 trisd5 trisd4 trisd3 trisd2 trisd1 trisd0 legend: ?= unimplemented location, read as ? r = reserved locations, default is por value and should not be overwritten with any value note: shaded boxes are not used by the i 2 c module.
1996 microchip technology inc. preliminary ds40122b-page 53 pic14000 figure 7-16: misc register 9eh bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 misc smhog spgndb spgnda i 2 csel smbus inclken osc2 osc1 read/write r/w r/w r/w r/w r/w r/w r/w r por value 00h 00000 0 0 x bit name function b7 smhog smhog enable 1 = stretch i 2 c clk signal (hold low) when receive data buffer is full (refer to section 7.5.4). for pausing i 2 c transfers while preventing interruptions of a/d conversions. 0 = disable i 2 c clk stretch. b6 spgndb serial port ground select 1 = portd<1:0> ground reference is the rd5/an5 pin. 0 = portd<1:0> ground reference is v ss . b5 spgnda serial port ground select 1 = portc<7:6> ground reference is the ra1/an1 pin. 0 = portc<7:6> ground reference is v ss . b4 i 2 csel i 2 c port select bit. 1 = portd<1:0> are used as the i 2 c clock and data lines. 0 = portc<7:6> are used as the i 2 c clock and data lines. b3 smbus smbus-compatibility select 1 = smbus compatibility mode is enabled. portc<7:6> and portd<1:0> have smbus-compatible input thresholds. 0 = smbus-compatibility is disabled. portc<7:6> and portd<1:0> have schmitt trig- ger input thresholds. b2 inclken oscillator output select (available in in mode only). 1 = output in oscillator signal divided by four on osc2 pin. 0 = disconnect in oscillator signal from osc2 pin. b1 osc2 osc2 output port bit (available in in mode only). writes to this location affect the osc2 pin in in mode. reads return the value of the output latch. b0 osc1 osc1 input port bit (available in in mode only). reads from this location return the status of the osc1 pin in in mode. writes have no effect.
pic14000 ds40122b-page 54 preliminary 1996 microchip technology inc. figure 7-17: operation of the i 2 c in idle_mode, rcv_mode or xmit_mode i dle_mode (7-bit): if (addr_match) { set interrupt; if (r/w = 1) { send ack = 0; set xmit_mode; } else if (r/w = 0) set rcv_mode; } rcv_mode: if ((i2cbuf=full) or (i 2 cov = 1)) { set i 2 cov; do not acknowledge; } else { transfer i 2 csr i 2 cbuf; send ack = 0; } receive 8-bits in i 2 csr; set interrupt; xmit_mode: while ((i2cbuf = empty) and (ckp=0)) hold scl low; send byte; set interrupt; if (ack received = 1) { end of transmission; go back to idle_mode; } else if (ack received = 0) go back to xmit_mode; idle_mode (10-bit): if (high_byte_addr_match and (r/w = 0)) { prior_addr_match = false; set interrupt; if ((i2cbuf = full) or ((i2cov = 1)) { set i2cov; do not acknowledge; } else { set ua = 1; send ack = 0; while (i2cadd not updated) hold scl low; clear ua = 0; receive low_addr_byte; set interrupt; set ua = 1; if (low_byte_addr_match) { prior_addr_match = true; send ack = 0; while (i2cadd not updated) hold scl low; clear ua = 0; set rcv_mode; } } } else if (high_byte_addr_match and (r/w = 1) { if (prior_addr_match) { send ack = 0; set xmit_mode; } else prior_addr_match = false; }
1996 microchip technology inc. preliminary ds40122b-page 55 pic14000 7.5.4 smbus and access.bus considerations pic14000 is compliant with the smbus speci?ation published by intel. some key points to note regarding the bus speci?ations and how it pertains to the pic14000 hardware are listed below: smbus has ?ed input voltage thresholds. pic14000 i/o buffers have programmable levels that can be selected to be compatible with both smbus threshold levels via the smbus and spgnd bits in the misc register. a mechanism to stretch the i 2 c clock time has been implemented to support smbus slave transactions. the smhog bit (misc<7>) allows hardware to automatically force and hold the i 2 c clock line low when a data byte has been received. this prevents the smbus master from over?wing the receive buffer in instances where the microcontroller may be to busy servicing higher priority tasks to respond to a i 2 c module interrupt. or, if the microcontroller is in sleep mode and needs time to wake-up and respond to the i 2 c interrupt. figure 7-18: smhog state machine smhog = 0 smhog = 1 i 2 cif = 1 smhog = 0 smhog = 0 smhog = 0 smhog = 0 i 2 cif = 0 i 2 cif = 0 i 2 cif = 1 i 2 cif = 0 i 2 cif = 0 i 2 cif = 1 scl = 0 scl = 1 a b c d e/drive scl low
pic14000 ds40122b-page 56 preliminary 1996 microchip technology inc. notes:
1996 microchip technology inc. preliminary ds40122b-page 57 pic14000 8.0 analog modules for a/d conversion 8.1 over vie w the pic14000 includes analog components to create a slope a/d converter including: comparator 4-bit programmable current source 16-channel analog mux 16-bit timer with capture register each channel is converted independently by means of a slope conversion method using a single precision comparator. the programmable current source feeds an external 0.1 m f (nominal) capacitor to generate the ramp voltage used in the conversion. 8.2 con ver sion pr ocess these are the steps to perform data conversion: clear refoff (slpcon<5>) and adoff (slpcon<0>) bits to enable the a/d module. initialize adcon1<7:4> to initialize the program- mable current source. set adrst (adcon0<1>), for a minimum of 200 m s to stop the timer and fully discharge the ramp capacitor to ground. the a/d timer (adtmr) increments from 0000h to ffffh and must be initialized before each con- version. to start a conversion, clear adrst through soft- ware, it will allow the timer to begin counting and the ramp capacitor to begin charging. when the ramp voltage exceeds the analog input, the comparator output changes from high to low. this transition causes a capture event and copies the current a/d timer value into the 16-bit capture register. an interrupt is generated to the cpu if enabled. note: the a/d timer continues to run following a capture event. the maximum a/d timer count is 65,536. it can be clocked by the on-chip or external oscillator. at a 4 mhz oscillation frequency, the maximum conversion time is 16.38 ms for a full count. a typical conversion should complete before full-count is reached. a timer over?w ?g is set once the timer rolls over (ffffh to 0000h), and an interrupt is sent to the cpu, if enabled. end-user calibration is simpli?d or eliminated by mak- ing use of the on-chip eprom. internal component val- ues are measured at factory ?al test and stored in the memory for use by the application ?mware. periodic conversion cycles should be performed on the bandgap and slope references (described in section 9.0) to compensate for a/d component drift. measurements for the reference voltage count are equated to the voltage value stored into eprom during calibration. all other channel measurements are compensated for by ratioing the actual count with the bandgap count and multiplying by the bandgap voltage value stored in eprom. since all measurements are relative to the reference, offset voltages inherent in the comparator are cancelled out. see an624, ?ic14000 a/d theory and implementation?for further details of a/d operation. the analog components used in the conversion and the a/d timer can be disabled during idle periods for maximum power savings. power-saving can be achieved via software and/or hardware control (section 10.8). 8.3 a/d timer (adtmr) module the a/d timer (adtmr) is comprised of a 16-bit up timer, which is incremented every oscillator cycle. adtmr is reset to 0000h by a power-up reset; other- wise the software must initialize it after each conver- sion. a separate 16-bit capture register (adcap) is used to capture the adtmr count if an a/d capture event occurs (see below). both the a/d timer and cap- ture register are readable and writable. the low byte of the a/d timer (adtmrl) is accessed at location 0eh while the high byte (adtmrh) is accessed at location 0fh. similarly, the low byte of the a/d capture register (adcap) is accessed at location 15h, and the high byte is located at 16h. this document was created with framemake r404
pic14000 ds40122b-page 58 preliminary 1996 microchip technology inc. caution: reading or writing the adtmr register during an a/d conversion cycle can pro- duce unpredictable results and is not recommended. during conversion one or both of the following events will occur: 1. capture event 2. timer over?w in a capture event, the comparator trips when the slope voltage on the cdac output exceeds the input voltage, causing the comparator output to transition from high to low. this causes a transfer of the current timer count to the capture register and sets the adcif ?g (pir1<1>). note: the correct sequence for writing the adtmr register is hi byte followed by lo byte. reversing this order will prevent the a/d timer from running. a cpu interrupt will be generated if bit adcie (pie1<1>) is set to ? (interrupt enabled). in addition, the global interrupt enable and peripheral interrupt enables (intcon<7,6>) must also be set. software is responsible for clearing the adcif ?g prior to the next conversion cycle. note that this interrupt can only occur once per conversion cycle. in a timer over?w condition, the timer rolls over from ffffh to 0000h, and a capture over?w ?g (ovfif) is asserted (pir1<0>). the timer continues to incre- ment following a timer over?w. a cpu interrupt can be generated if bit ovfie (pie1<0>) is set (interrupt enabled). in addition, the global interrupt enable and peripheral interrupt enables (intcon<7,6>) must also be set. software is responsible for clearing the ovfif ?g prior to the next conversion cycle. figure 8-1: a/d block diagram (nominal) adoff write_tmr osc1 1 0 fosc (con?uration bit) internal adtmrh adtmrl clock stop logic timer (ovfif, pir1<0>) adcaph adcapl oscillator analog mux prog. ref. a 7 6 5 4 3 2 1 0 temp sensor sreflo srefhi ra2/an2 ra1/an1 ra0/an0 a/d capture a/d capture interrupt adoff cdac ~2.5ua~5ua~10ua~20ua adcon1<7:4> 0.1 m f adrst (adcon0<1>) ra3/an3 8 ~100 w adoff bandgap ref. prog. ref. b 9 ~ 1 kohm rd4/an4 rd5/an5 rd6/an6 rd7/an7 10 11 12 13 reserved reserved 14 15 amuxoe (adcif, pir1<1>) over?w internal data bus adrst 4 note 2 note 1: all current sources are disabled if adrst = ? note 2: approximately 3.5 microsecond time constant note 1 4-bit current dac adcon0<7:4> (slpcon<0>) (adcon0<2>) ra0/an0
1996 microchip technology inc. preliminary ds40122b-page 59 pic14000 figure 8-2: example a/d conversion cycle figure 8-3: a/d capture timer (low byte) figure 8-4: a/d capture timer (high byte) figure 8-5: a/d capture register (low byte) figure 8-6: a/d capture register (high byte) legend: u= unimplemented, x = unknown. 0eh bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 adtmrl b7 b6 b5 b4 b3 b2 b1 b0 read/write r/w r/w r/w r/w r/w r/w r/w r/w por value 00h 0000 0 0 0 0 0fh bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 adtmrh b15 b14 b13 b12 b11 b10 b9 b8 read/write r/w r/w r/w r/w r/w r/w r/w r/w por value 00h 0000 0 0 0 0 15h bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 adcapl b7 b6 b5 b4 b3 b2 b1 b0 read / write r/w r/w r/w r/w r/w r/w r/w r/w por value 00h 0000 0 0 0 0 16h bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 adcaph b15 b14 b13 b12 b11 b10 b9 b8 read/write r/w r/w r/w r/w r/w r/w r/w r/w por value 00h 0000 0 0 0 0 xx capture clk adrst adcon0<1> capture register cdac xx+8 compare adcif , pir1<1> (must be cleared by software) adtmr increments xx+1 xx+2 xx+3 adtmr count xx+8 xx+9 xx
pic14000 ds40122b-page 60 preliminary 1996 microchip technology inc. 8.4 a/d comparator the pic14000 includes a high gain comparator for a/d conversions. the positive input terminal of the a/d comparator is connected to the output of an analog mux through an rc low-pass ?ter. the nominal time-constant for the rc ?ter is 3.5 m s. the negative input terminal is connected to the external 0.1 m f (nom- inal) ramp capacitor. 8.5 analog mux a total of 16 channels are internally multiplexed to the single a/d comparator positive input. four con?uration bits (adcon0<7:4>) select the channel to be converted. refer to table 8-1 for channel assign- ments. table 8-1: a/d channel assignment adcon0(7:4) a/d channel 0000 ra0/an0 pin 0001 ra1/an1 pin 0010 ra2/an2 pin 0011 ra3/an3 pin 0100 bandgap reference voltage 0101 slope reference srefhi 0110 slope reference sreflo 0111 internal temperature sensor 1000 programmable reference a output 1001 programmable reference b output 1010 rd4/an4 pin 1011 rd5/an5 pin 1100 rd6/an6 pin 1101 rd7/an7 pin 1110 reserved 1111 reserved
1996 microchip technology inc. preliminary ds40122b-page 61 pic14000 8.6 pr ogrammab le current sour ce four con?uration bits (adcon1<7:4>) are used to control a programmable current source for generating the ramp voltage to the a/d comparator. it allows com- pensation for full-scale input voltage, clock frequency and cdac capacitor tolerance variations. the current values range from 0 to 33.75 m a (nominal) in 2.25 m a increments. the intermediate values of the current source are as follows: table 8-2: programmable current source selection adcon1<7:4> current source output 0000 off - all current sources disabled 0001 2.25 m a 0010 4.5 m a 0011 6.75 m a 01009 m a 0101 11.25 m a 0110 13.5 m a 0111 15.75 m a 100018 m a 1001 20.25 m a 1010 22.5 m a 1011 24.75 m a 110027 m a 1101 29.25 m a 1110 31.5 m a 1111 33.75 m a the programmable current source output is tied to the cdac pin and is used to charge an external capacitor to generate the ramp voltage for the a/d comparator. (refer to figure 8-1.) this capacitor should have a low voltage-coef?ient as found in te?n, polypropylene, or polystyrene capacitors, for optimum results. the capacitor must be discharged at the beginning of each conversion cycle by asserting adrst (adcon0<1>) for at least 200 m s to allow a complete discharge. asserting adrst disables the current sources inter- nally. current ?w begins when adrst is cleared.
pic14000 ds40122b-page 62 preliminary 1996 microchip technology inc. 8.7 a/d contr ol register s two a/d control registers are provided on the pic14000 to control the conversion process. these are adcon0 (1fh) and adcon1 (9fh). both registers are readable and writable. table 8-3: a/d control and status register 0 1fh bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 adcon0 adcs3 adcs2 adcs1 adcs0 amuxoe adrst adzero read/write r/w r/w r/w r/w u r/w r/w r/w por value 02h 0000 0 0 1 0 bit name function b7-b4 adcs3 adcs2 adcs1 adcs0 a/d channel selects. refer to table 8-1. b3 unimplemented. read as ?? b2 amuxoe analog mux output enable 1 = connect amux output to ra0/an0 pin (overrides trisa<0> setting) 0 = ra0/an0 pin normal b1 adrst a/d reset control bit 1 = stop the a/d timer, discharge cdac capacitor 0 = normal operation (a/d running) b0 adzero a/d zero select control. (refer to section 9.2) 1 = enable zeroing operation on ra1/an1 and rd5/an5 0 = normal operation (sample ra1/an1 and rd5/an5 pins)
1996 microchip technology inc. preliminary ds40122b-page 63 pic14000 table 8-4: a/d control and status register 1 table 8-5: porta and portd configuration legend: a = analog input, d = digital i/o 9fh bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 adcon1 addac3 addac2 addac1 addac0 pcfg3 pcfg2 pcfg1 pcfg0 read/write r/w r/w r/w r/w r/w r/w r/w r/w por value 00h 000000 0 0 bit name function b7-b4 addac3 addac2 addac1 addac0 a/d current source selects. refer to table 8-2. b3-b2 pcfg3 pcfg2 portd configuration selects (see table 8-5) b1-b0 pcfg1 pcfg0 porta configuration selects (see table 8-5) adcon1<1:0> ra0/an0 ra1/an1 ra2/an2 ra3/an3 adcon1<3:2> rd4/an4 rd5/an5 rd6/an6 rd7/an7 0 0 aaaa 0 1 aaad 1 0 aadd 1 1 dddd
pic14000 ds40122b-page 64 preliminary 1996 microchip technology inc. 8.8 a/d speed, resolution and capacitor selection the conversion time for the a/d converter on the pic14000 can be calculated using the equation: conversion time = (1/fosc) x 2 n where fosc is the oscillator frequency and n is the number of bits of resolution desired. therefore at 4mhz, the conversion time for 16 bits is 16.384 msec. conversely, it is 256 m sec for 10 bits. choosing the correct ramp capacitor for the cdac pin is required to achieve the desired resolution, conver- sion time and full scale input voltage. the equation for selecting the ramp capacitor value is: capacitor = (conversion time in seconds) x (current source output in amps) / (full scale in volts) table 8-6 provides example capacitor values for the desired a/d resolution, conversion time, and full scale voltage measurement. table 8-6: cdac capacitor selection (examples for full scale of 3.5v and 1.5v) a/d resolution (bits) conversion time (seconds) full scale (volts) a/d current source output ( m amps) calculated cdac capacitor (farads) cdac capacitor nearest standard value 16 0.016384 3.5 24.75 1.17e-07 .1uf 14 0.004096 3.5 24.75 2.93e-08 .022uf 12 0.001024 3.5 24.75 7.31e-09 6800pf 16 0.016384 1.5 24.75 2.73e-07 0.22 m f 14 0.004096 1.5 24.75 6.83e-08 68nf 12 0.001024 1.5 24.75 1.71e-08 15nf note: assumes f osc of 4 mhz.
1996 microchip technology inc. preliminary ds40122b-page 65 pic14000 9.0 other analog modules the pic14000 has additional analog modules for mixed signal applications. these include: bandgap voltage reference comparators with programmable references internal temperature sensor voltage regulator control 9.1 bandgap v olta g e ref erence the bandgap reference circuit is used to generate a 1.2v nominal stable voltage reference for the a/d and the low-voltage detector. the bandgap reference is channel 4 of the analog mux. the bandgap reference voltage is stored in the calibration space eprom (see table 4-2). to enable the bandgap reference refoff (slpcon<5>) must be cleared. 9.2 le vel-shift netw orks the ra1/an1 and ra5/an5 pins have an internal level-shift network. a current source and resistor are used to bias the pin voltage by about +0.5v into a range usable by the a/d converter. the nominal value of bias current source is 5 m a and the resistor is 100 kohms. the level-shift function can be turned on by clearing the lsoff bit (slpcon<4>) to '0'. note: the minimum voltage permissible at the ra1/an1 and ra5/an5 pins is -0.3v. the input protection diodes will begin to turn on beyond -0.3v, introducing signi?ant errors in the a/d readings. under no con- ditions should the pin voltage fall below -0.5v. 9.2.1 zeroing/filtering switches the ra1/an1 and ra5/an5 inputs also have a matched pair of pass gates useful for current-measure- ment applications. one gate is connected between the pin and the level-shift network. the second pass gate is connected to ground as shown in figure 9-1. by set- ting the adzero bit (adcon0<0>), a zero-current condition is simulated. subsequent a/d readings are calculated relative to this zero count from the a/d. this zeroing of the current provides very high accuracies at low current values where it is most needed. for additional noise ?tering or for capturing short dura- tion periodic pulses, an optional ?ter capacitor may be connected from the sum pin to ground (this feature is available for ra1/an1 only). this forms an rc network with the internal 100 kohm (nominal) bias resistor to act as a low pass ?ter. the capacitor size can be adjusted for the desired time constant. a switch is included between the output from the ra1/an1 level-shift network and the sum pin. this switch is closed during a/d sampling periods and is automatically opened during a zeroing operation (if adzero = '1'). if not required in the system, this pin should be left ?ating (not connected). setting the lsoff bit (slpcon<4>) disables the level-shift networks, so the ra1/an1 and ra5/an5 pins can continue to be used as general-purpose ana- log inputs. this document was created with framemake r404
pic14000 ds40122b-page 66 preliminary 1996 microchip technology inc. figure 9-1: level-shift networks 5 m a (nominal) 100 k w to a/d mux, ra1/an1 sum external capacitor (optional) (nominal) *these switches are a matched pair programmable lsoff (slpcon<4>) v dd input protection diodes * rd5/an5 ra1/an1 only * lsoff (slpcon<4>) adzero (adcon<0>) reference comparators v dd 9.3 slope ref erence v olta g e divider the slope reference voltage divider circuit, consisting of a buffer ampli?r and resistor divider, is connected to the internal bandgap reference producing two other voltage references called srefhi and sreflo (see figure 9-2). srefhi is nominally the same as the bandgap voltage, 1.2v, and sreflo is nominally 0.13v. these reference voltages are available on two of the analog multiplexer channels. the a/d module and ?mware can measure the srefhi and sreflo voltages, and in conjunction with the k ref and k bg cal- ibration data correct for the a/d's offset and slope errors. see an624 for further details. 9.4 internal t emperature sensor the internal temperature sensor is connected to the channel 7 input of the a/d converter. the sensor volt- age is 1.05v nominal at 25 c and its temperature coef- ?ient is approximately 3.7mv/ c. the sensor voltage at 25 c and the temperature coef?ient values are stored in the calibration space eprom (see table 4-2). to enable the temperature sensor, the tempoff bit (slpcon<1>) must be cleared.
1996 microchip technology inc. preliminary ds40122b-page 67 pic14000 figure 9-2: slope reference divider + bandgap reference _ refoff (slpcon<5>) adoff (slpcon<0>) srefhi sreflo v ref to a/d mux sreflo srefhi ~ 9 sreflo srefhi - sreflo k ref = 9.5 comparator and pr ogrammab le ref erence modules 9.5.1 comparators the pic14000 includes two independent low-power comparators for comparing the programmable refer- ence outputs to either the ra1/an1 or ra5/an5 pins. the negative input of each comparator is tied to one of the reference outputs as shown in figure 9-3. the comparator positive inputs are connected to the output of the ra1/an1 and ra5/an5 level-shift networks. at reset, the ra1/an1 level-shift output is connected to the positive inputs of both comparators. this allows a window comparison of the ra1/an1 voltage using the two programmable references and comparators. set- ting cmboe (cmcon<5>) changes the con?uration so that ra1/an1 and ra5/an5 may be independently monitored. the comparator outputs can be read by the cmaout (cmcon<2>) and cmbout (cmcon<6>) bits. these are read-only bits and writes to these locations have no effect. either a rising or falling comparator output can gener- ate an interrupt to the cpu as controlled by the polarity bits cpola (cmcon<0>) and cpolb (cmcon<4>). the cmif bit (pir1<7>) interrupt ?g is set whenever the exclusive-or of the comparator output cmxout and the cpolx bits equal a logic one. as with other peripheral interrupts, the corresponding enable bit cmie (pie1<7>) must also be set to enable the com- parator interrupt. in addition, the global interrupt enable and peripheral interrupt enable bits intcon<7:6> must also be set. this comparator interrupt is level sen- sitive. the comparator outputs are visible at either rc1/cmpa or rd2/cmpb pins by setting the cmaoe (cmcon<1>) or cmboe (cmcon<5>) bits. setting cmxoe does not affect the comparator operation. it only enables the pin function regardless of the port tris register setting. both the references and the comparators are enabled by clearing the cmoff (slpcon<2>) bit. 9.5.2 programmable references the pic14000 includes two independent, programma- ble voltage references. each reference is built using two resistor ladders, bandgap-referenced current source, and analog multiplexers. the ?st ladder con- tains 32 taps, and is divided into three ranges (upper, middle, and lower) to provide a coarse voltage adjust- ment. the coarse ladder includes 1k and 10k resistors yielding a step size of either 5 or 50 mv (nominal) depending on the selected range. figure 9-8 shows the comparator and reference architecture. a second ladder contains eight taps, and is connected across the selected coarse ladder resistor to increase resolution. this subdivides the coarse ladder step by approximately 1/8. thus, resolutions approaching 5/8 mv are obtainable.
pic14000 ds40122b-page 68 preliminary 1996 microchip technology inc. two registers prefa (9bh) and prefb (9ch) are used to select the reference output voltages. the prefx<7:3> bits select the output from the coarse lad- der, while prefx<2:0> bits are for the ?e-tune adjust- ment. table 9-1 and table 9-2 show the reference decoding. these voltages are visible at either rc0/refa or rd3/refb pins by setting the cmaoe (cmcon<1>) or cmboe (cmcon<5>) bits. setting cmxoe does not affect the reference voltages. it only enables the pin function regardless of the port tris register setting. these outputs are not buffered, so they cannot directly drive any dc loads. the reference outputs are also connected to two inde- pendent comparators, compa and compb. thus, the references can be used to set the comparator trip- points. the a/d converter can also monitor the refer- ence outputs via a/d channels 8 and 9. refer to section 8 for the description of the a/d operation. the programmable reference output is designed to track the output from the level shift network. however, there will always be some mismatch due to component drift. for best accuracy, the a/d should be used to peri- odically calibrate the references to the desired set-point. figure 9-3: comparator and programmable reference block diagram (one of two shown) from an1 level shift network cmoff rc1/cmpa or rc0/refa or ~5 m a prefx<7:3> prefx<7:3> cpolx to a/d converter analog mux (1 of 32) analog mux (1-of-8) prefx<2:0> ~ 0.15v ~ 0.85v fine tune adjust coarse adjust to cmxout bit, cmcon register _ + programmable analog mux (1 of 32) rd3/refb cmxoe rd2/cmpb from other comparator cmif bit pir1<7> reference from an5 level shift network cmboe channel b only
1996 microchip technology inc. preliminary ds40122b-page 69 pic14000 table 9-1: programmable reference coarse range selection prefx<7:3> nominal output voltage range (v) upper 01111 0.8000 - 0.8500 01110 0.7500 - 0.8000 01101 0.7000 - 0.7500 01100 0.6500 - 0.7000 01011 0.6000 - 0.6500 01010 0.5500 - 0.6000 middle 01001 0.5450 - 0.5500 01000 0.5400 - 0.5450 00111 0.5350 - 0.5400 00110 0.5300 - 0.5350 00101 0.5250 - 0.5300 00100 0.5200 - 0.5250 00011 0.5150 - 0.5200 00010 0.5100 - 0.5150 00001 0.5050 - 0.5100 00000 0.5000 - 0.5050 10000 0.4950 - 0.5000 10001 0.4900 - 0.4950 10010 0.4850 - 0.4900 10011 0.4800 - 0.4850 10100 0.4750 - 0.4800 10101 0.4700 - 0.4750 10110 0.4650 - 0.4700 10111 0.4600 - 0.4650 11000 0.4550 - 0.4600 11001 0.4500 - 0.4550 lower 11010 0.4000 - 0.4500 11011 0.3500 - 0.4000 11100 0.3000 - 0.3500 11101 0.2500 - 0.3000 11110 0.2000 - 0.2500 11111 0.1500 - 0.2000
pic14000 ds40122b-page 70 preliminary 1996 microchip technology inc. table 9-2: programmable reference fine range selection prefx<2:0> fractional value of the coarse range 000 1/8 001 1/4 010 3/8 011 1/2 100 5/8 101 3/4 110 7/8 111 1 figure 9-4: programmable reference transfer function 0.1 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 volts prefx value (hex) f8 c8 d7 00 50 4f 7f middle range lower range upper range
1996 microchip technology inc. preliminary ds40122b-page 71 pic14000 figure 9-5: comparator control register 9dh bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 cmcon u cmbout cmboe cpolb u cmaout cmaoe cpola read/write r r/w r/w r r/w r/w por value 00h 00 0 0 0 0 0 0 bit name function b7 unimplemented. read as ?? b6 cmbout comparator b output reading this bit returns the status of the comparator b output. writes to this bit have no effect. b5 cmboe comparator b output enable 1 = comparator b output is available on rd2/cmpb pin and reference b output is available on rd3/refb pin. 0 = rd2/cmpb and rd3/refb assume normal portd function. b4 cpolb comparator b polarity bit 1 = invert the output of comparator b. 0 = do not invert the output of comparator b. b3 unimplemented. read as ?? b2 cmaout comparator a output reading this bit returns the status of the comparator a output. writes to this bit have no effect. b1 cmaoe comparator a output enable 1 = comparator a output is available on rc1/cmpa pin and reference a output is available on rc0/refa pin. 0 = rc0/refa and rc1/cmpa assume normal portc function. b0 cpola comparator a polarity bit 1 = invert the output of comparator a. 0 = do not invert the output of comparator a.
pic14000 ds40122b-page 72 preliminary 1996 microchip technology inc. figure 9-6: prefa register figure 9-7: prefb register 9bh bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 prefa pra7 pra6 pra5 pra4 pra3 pra2 pra1 pra0 read/write r/w r/w r/w r/w r/w r/w r/w r/w por value 00h 00 0 0 0 0 0 0 bit name function b7-b0 pra7 pra6 pra5 pra4 pra3 pra2 pra1 pra0 programmable reference a voltage select bits. see table 9-1 and table 9-2 for decoding. 9ch bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 prefb prb7 prb6 prb5 prb4 prb3 prb2 prb1 prb0 read/write r/w r/w r/w r/w r/w r/w r/w r/w por value 00h 00 0 0 0 0 0 0 bit name function b7-b0 prb7 prb6 prb5 prb4 prb3 prb2 prb1 prb0 programmable reference b voltage select bits. see table 9-1 and table 9-2 for decoding.
1996 microchip technology inc. preliminary ds40122b-page 73 pic14000 9.6 v olta g e regulator output for systems with a main supply voltage above 6v, an inexpensive, low quiescent current voltage regulator can be formed by connecting the vreg pin to an exter- nal resistor and fet as shown in figure 9-8. this cir- cuit will provide a vdd of about 5v, after the voltage drop across the fet. figure 9-8: voltage regulator circuit v reg v dd 1-10 m a recommended main supply optional external voltage regulator (not required for supply voltages below 6.0 v) pic14000 n-fet 6v typical (enhancement)
pic14000 ds40122b-page 74 preliminary 1996 microchip technology inc. notes:
1996 microchip technology inc. preliminary ds40122b-page 75 pic14000 10.0 special features of the cpu what sets apart a microcontroller from other processors are special circuits to deal with the needs of real time applications. the pic14000 has a host of such features intended to maximize system reliability, minimize cost through elimination of external components, provide power saving operating modes and offer code protection. these are: osc (oscillator) selection - crystal/resonator - internal oscillator reset options - power-on reset (por) - power-up timer (pwrt) - oscillator start-up timer (ost) interrupts watchdog timer (wdt) sleep and hibernate modes code protection in-circuit serial programming these features will be described in the following sections. 10.1 c on guration bits the con?uration bits can be programmed (read as '0') or left unprogrammed (read as '1') to select various device con?urations. these bits are mapped in pro- gram memory location 2007h. the user will note that address 2007h is beyond the user program memory space. in fact, it belongs to the special test/con?uration memory space (2000h - 3fffh), which can be accessed only during program- ming. figure 10-1: configuration word 2007h bit 13-8 bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 bits r cpc r cpp1 cpp0 pwrte wdte r fosc read/write r/w r/w reserved r/w r/w r/w r/w reserved r/w erased value 1111111 1 1 bit name function b13-b8 r reserved b7 cpc calibration space code protection bit 1 = calibration space is readable and programmable 0 = calibration space is write protected b6 r reserved b5 cpp1 program space code protection bit 1 = program space is readable and programmable 0 = program space is read/write protected b4 cpp0 program space code protection bit 1 = program space is readable and programmable 0 = program space is read/write protected b3 pwr te power-up timer enable bit 1 = power-up timer is disabled 0 = power-up timer is enabled b2 wdte watchdog timer enable bit 1 = wdt is enabled 0 = wdt is disabled b1 r reserved b0 fosc oscillator selection bit 1 = in oscillator (internal) 0 = hs oscillator (crystal/resonator) this document was created with framemake r404
pic14000 ds40122b-page 76 preliminary 1996 microchip technology inc. 10.2 oscillator con gurations the pic14000 can be operated with two different oscil- lator options. the user can program a con?uration word (config<0>) to select one of these: hs high speed crystal/ceramic resonator (config<0> =?? in internal oscillator (config<0> =?? (default) 10.2.1 internal oscillator circuit the pic14000 includes an internal oscillator option that offers additional cost and board-space savings. no external components are required. the nominal operating frequency is 4 mhz. the frequency is mea- sured and stored into the calibration space in eprom. by selecting in mode osc1/pbtn becomes a digital input (with weak internal pull-up resistor) and can be read via bit misc<0>. writes to this location have no effect. the osc1/pbtn input is capable of generating an interrupt to the cpu if enabled (section 10.6). also, the osc2 pin becomes a digital output for general pur- pose use and is accessed via misc<1>. writes to this bit directly affect the osc2 pin. reading this bit returns the contents of the output latch. the misc register format is shown in figure 10-2. the osc2 pin can also output the in oscillator fre- quency, divided-by-four, by setting inclken (misc<2>). note: the osc2 output buffer provides less drive than standard i/o. figure 10-2: misc register 9eh bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 misc smhog spgndb spgnda i 2 csel smbus inclken osc2 osc1 read/write r/w r/w r/w r/w r/w r/w r/w r por value 00h 0 0 0 0 00 0x bit name function b7 smhog smhog enable 1 = stretch i 2 c clk signal (hold low) when receive data buffer is full (refer to section 7.5.4). for pausing i 2 c transfers while preventing interruptions of a/d conversions. 0 = disable i 2 c clk stretch. b6 spgndb serial port ground select 1 = portd<1:0> ground reference is the rd5/an5 pin. 0 = portd<1:0> ground reference is v ss . b5 spgnda serial port ground select 1 = portc<7:6> ground reference is the ra1/an1 pin. 0 = portc<7:6> ground reference is v ss . b4 i 2 csel i 2 c port select bit. 1 = portd<1:0> are used as the i 2 c clock and data lines. 0 = portc<7:6> are used as the i 2 c clock and data lines. b3 smbus smbus-compatibility select 1 = smbus compatibility mode is enabled. portc<7:6> and portd<1:0> have smbus-compatible input thresholds. 0 = smbus-compatibility is disabled. portc<7:6> and portd<1:0> have schmitt trig- ger input thresholds. b2 inclken oscillator output select (available in in mode only). 1 = output in oscillator signal divided by four on osc2 pin. 0 = disconnect in oscillator signal from osc2 pin. b1 osc2 osc2 output port bit (available in in mode only). writes to this location affect the osc2 pin in in mode. reads return the value of the output latch. b0 osc1 osc1 input port bit (available in in mode only). reads from this location return the status of the osc1 pin in in mode. writes have no effect.
1996 microchip technology inc. preliminary ds40122b-page 77 pic14000 10.2.2 crystal oscillator/ceramic resonator in hs mode, a crystal or ceramic resonator is con- nected to the osc1 and osc2 pins to establish oscil- lation. a parallel cut crystal is required. use of a series cut crystal may give a frequency outside of the crystal manufacturers speci?ations. when in hs mode, the device can have an external clock source to drive the osc1 pin. figure 10-3: crystal/ceramic resonator operation (hs osc configuration) figure 10-4: external clock input operation (hs osc configuration) table 10-1: ceramic resonators mode freq c1 c2 hs 4 mhz 8 mhz 16 mhz 15 - 68 pf 10 - 68 pf 10 - 22 pf 15 - 68 pf 10 - 68 pf 10 - 22 pf note : recommended values of c1 and c2 are identical to the ranges tested table. higher capacitance increases the stability of oscillator but also increases the start-up time. these values are for design guidance only. since each resonator has its own characteristics, the user should consult the resonator manufacturer for appropriate values of external components. resonators used: 4 mhz murata erie csa4.00mg +/-.5% 8 mhz murata erie csa8.00mt +/-.5% 16 mhz murata erie csa16.00mx +/-.5% all resonators used did not have built-in capacitors. see table 10-1 and table 10-2 for recommended values of c1 and c2. c1 c2 xtal osc2 note1 osc1 rf sleep to internal logic pic14000 rs slpcon<3> note 1: a series resistor may be required for at strip cut crystals. osc1 clock from ext. system osc2 open pic14000 table 10-2: capacitor selection for crystal oscillator 10.2.3 external crystal oscillator circuit either a prepackaged oscillator can be used or a simple oscillator circuit with ttl gates can be built. prepackaged oscillators provide a wide operating range and better stability. a well-designed crystal oscillator will provide good performance with ttl gates. two types of crystal oscillator circuits can be used; one with series resonance, or one with parallel resonance. figure 10-5 shows implementation of a parallel resonant oscillator circuit. the circuit is designed to use the fundamental frequency of the crystal. the 74as04 inverter performs the 180-degree phase shift that a parallel oscillator requires. the 4.7 k w resistor provides the negative feedback for stability. the 10 k w potentiometer biases the 74as04 in the linear region. this could be used for external oscillator designs. figure 10-5: external parallel resonant crystal oscillator circuit mode freq c1 c2 hs 4 mhz 8 mhz 20 mhz 15 - 33 pf 15 - 47 pf 15 - 47 pf 15 - 33 pf 15 - 47 pf 15 - 47 pf note : higher capacitance increases the stability of oscillator but also increases the start-up time. these values are for design guidance only. rs may be required in hs mode to avoid overdriving crystals with low drive level speci?ation. since each crystal has its own characteristics, the user should consult the crystal manufacturer for appropriate values of external components. for v dd > 4.5v, c1 = c2 ? 30pf is recommended. 20pf +5v 20pf 10k 4.7k 10k 74as04 xtal 10k 74as04 osc1 to other devices
pic14000 ds40122b-page 78 preliminary 1996 microchip technology inc. figure 10-6 shows a series resonant oscillator circuit. this circuit is also designed to use the fundamental frequency of the crystal. the inverter performs a 180-degree phase shift in a series resonant oscillator circuit. the 330 k w resistors provide the negative feedback to bias the inverters in their linear region. figure 10-6: external series resonant crystal oscillator circuit 330k w 74as04 74as04 pic14000 osc1 to other devices xtal 330k w 74as04 0.1 m f 10.3 reset the pic14000 differentiates between various kinds of reset: power-on reset (por) mclr reset during normal operation mclr reset during sleep wdt reset (normal operation) some registers are not affected in any reset condition; their status is unknown on por and unchanged in any other reset. most other registers are reset to a ?eset state?on power-on reset (por), on the mclr and wdt reset, and on mclr reset during sleep. they are not affected by a wdt wake-up, which is viewed as the resumption of normal operation. the t o and pd bits are set or cleared differently in different reset situ- ations as indicated in table 10-3. these bits are used in software to determine the nature of the reset. see table 10-5 for a full description of reset states of all reg- isters. a simpli?d block diagram of the on-chip reset circuit is shown in figure 10-7. the devices all have a mclr noise ?ter in the mclr reset path. the ?ter will detect and ignore small pulses. it should be noted that a wdt reset does not drive mclr pin low. figure 10-7: simplified block diagram of on-chip reset circuit s r q external reset mclr v dd osc1 wdt module v dd rise detect ost/pwrt on-chip (1) rc osc wdt time-out power-on reset ost 10-bit ripple counter pwrt chip_reset 10-bit ripple counter enable ost enable pwrt sleep note 1: this is a separate oscillator from the rc oscillator of the clkin pin.
1996 microchip technology inc. preliminary ds40122b-page 79 pic14000 10.4 lo w-v olta g e detector the pic14000 contains an integrated low-voltage detector. the supply voltage is divided and compared to the bandgap reference output. if the supply voltage (v dd ) falls below v trip -, then the low-voltage detector will cause l vd (pcon<0>) to be reset. this bit can be read by software to determine if a low voltage condition occurred. this bit must be set by software. the nominal values of the low-voltage detector trip points are as follows: ? trip - = 2.55v ? trip + = 2.60v hysteresis (v trip + ? v trip -) = 55 mv 10.5 p o wer -on reset (por), p o wer -up timer (pwr t) and oscillator star t-up timer (ost) 10.5.1 power-on reset (por) a power-on reset pulse is generated on-chip when v dd rise is detected (in the range of 1.5v - 2.1v). to take advantage of the por, just tie the mclr pin directly (or through a resistor) to v dd . this will elimi- nate external rc components usually needed to create a power-on reset. a maximum rise time for v dd is speci?d. see electrical speci?ations for details. when the device starts normal operation (exits the reset condition), device operating parameters (voltage, frequency, temperature, ...) must be met to ensure operation. if these conditions are not met, the device must be held in reset until the operating conditions are met. for additional information, refer to application note an607, power-up trouble shooting . 10.5.2 power-up timer (pwrt) the power-up timer provides a ?ed 72 ms (nominal) time-out on power-up only, from por . the power-up timer operates from a local internal oscillator. the chip is kept in reset as long as pwrt is active. the pwrt delay allows the v dd to rise to an acceptable level. a con?uration bit, pwr te , can disable (if set, or unpro- grammed) or enable (if cleared, or programmed) the power-up timer. the power-up timer delay will vary from chip to chip and due to v dd and temperature. 10.5.3 oscillator start-up timer (ost) the oscillator start-up timer (ost) provides 1024 oscillator cycles (from osc1 input) delay after the pwrt delay is over. this guarantees that the crystal oscillator or resonator has started and stabilized. 10.5.4 in oscillator start-up there is an 8-cycle delay in in mode to ensure stability only after a power-on reset (por) or wake-up from sleep. table 10-3: status bits and their significance por t o pd meaning 011 power-on reset 00x illegal, t o is set on por 0x0 illegal, pd is set on por 101 wdt reset during normal operation 100 wdt time-out wakeup from sleep 111 mclr reset during normal operation 110 mclr reset during sleep or hibernate, or interrupt wake-up from sleep or hibernate.
pic14000 ds40122b-page 80 preliminary 1996 microchip technology inc. 10.5.5 timeout sequence on power-up the time-out sequence is as follows: first the pwrt time-out is invoked after por has expired. the ost is activated only in hs (crystal oscillator) mode. the total time-out will vary based on the oscilla- tor con?uration and pwr te status. for example, in in mode, with pwr te unprogrammed (pwrt dis- abled), there will be no time-out delay at all. figure 13-4 depicts the power-on reset time-out sequences. table 10-4 shows the reset conditions for some special registers, while table 10-5 shows the reset conditions for all registers. figure 10-8: external power-on reset circuit (for slow v dd power-up) 1. external power-on reset circuit is required only if v dd power-up slope is too slow. the diode d helps discharge the capacitor quickly when v dd powers down. 2. r < 40 k w is recommended to make sure that voltage drop across r does not exceed 0.2v (max leakage current spec on mclr pin is 5 m a). a larger voltage drop will degrade vih level on mclr pin. 3. r1 = 100 w to 1 k w will limit any current ?wing into mclr from external capacitor c in the event of mclr pin breakdown due to esd or eos. pic14000 mclr v dd d c r1 r v dd table 10-4: reset condition for special registers legend: u = unchanged x = unknown - = unimplemented, read as ? note 1: when the wake-up is due to an interrupt and the gie bit is set, the pc is loaded with the interrupt vector (0004h). condition pcl addr: 02h status addr: 03h pcon addr: 8eh power-on reset 000h 0001 1xxx 0--- --0x mclr reset during normal operation 000h 0001 1uuu u--- --ux mclr reset during sleep 000h 0001 0uuu u--- --ux wdt reset during normal operation 000h 0000 1uuu u--- --ux wdt during sleep pc + 1 uuu0 0uuu u--- --ux interrupt wake-up from sleep pc + 1 (1) uuu1 0uuu u--- --ux
1996 microchip technology inc. preliminary ds40122b-page 81 pic14000 table 10-5: reset conditions for registers register address power-on reset mclr reset during - normal operation - sleep wdt time-out during normal operation wake-up from sleep through interrupt wake up from sleep through wdt time-out w- xxxx xxxx uuuu uuuu uuuu uuuu indf 00h/80h -- - tmr0 01h xxxx xxxx uuuu uuuu uuuu uuuu pcl 02h/82h 0000h 0000h pc + 1 (2) status 03h/83h 0001 1xxx 000? ?uuu (3) uuu? ?uuu (3) fsr 04h/84h xxxx xxxx uuuu uuuu uuuu uuuu porta 05h ---- xxxx ---- uuuu ---- uuuu portc 07h xxxx xxxx uuuu uuuu uuuu uuuu portd 08h xxxx xxxx uuuu uuuu uuuu uuuu pclath 0ah/8ah ---0 0000 ---0 0000 ---u uuuu intcon 0bh/8bh 0000 000x 0000 000u uuuu uuuu (1) pir1 0ch 0000 0000 0000 0000 uuuu uuuu (1) adtmrl 0eh 0000 0000 0000 0000 uuuu uuuu adtmrh 0fh 0000 0000 0000 0000 uuuu uuuu i2cbuf 13h xxxx xxxx uuuu uuuu uuuu uuuu i2ccon 14h 0000 0000 0000 0000 uuuu uuuu adcapl 15h 0000 0000 0000 0000 uuuu uuuu adcaph 16h 0000 0000 0000 0000 uuuu uuuu adcon0 1fh 0000 0010 0000 0010 uuuu uuuu option 81h 1111 1111 1111 1111 uuuu uuuu trisa 85h ---- 1111 ---- 1111 ---- uuuu trisc 87h 1111 1111 1111 1111 uuuu uuuu trisd 88h 1111 1111 1111 1111 uuuu uuuu pie1 8ch 0000 0000 0000 0000 uuuu uuuu pcon 8eh ---- --0x ---- --uu ---- --uu slpcon 8fh 0011 1111 0011 1111 uuuu uuuu i2cadd 93h 0000 0000 0000 0000 uuuu uuuu i2cstat 94h --00 0000 --00 0000 --uu uuuu prefa 9bh 0000 0000 0000 0000 uuuu uuuu prefb 9ch 0000 0000 0000 0000 uuuu uuuu cmcon 9dh 0x00 0x00 0x00 0x00 uuuu uuuu misc 9eh 0000 000x 0000 000x uuuu uuuu adcon1 9fh 0000 0000 0000 0000 uuuu uuuu legend: u =unchanged, x =unknown, - = unimplemented, reads as ?? ? = value depends on condition. note 1: one or more bits in intcon and/or pir1 will be affected (to cause wake-up). 2: when the wake-up is due to an interrupt and the gie bit is set, the pc is loaded with the interrupt vector (0004h). 3: see table 10-4 for reset value for speci? condition.
pic14000 ds40122b-page 82 preliminary 1996 microchip technology inc. 10.6 interrupts the pic14000 has several sources of interrupt: external interrupt from osc1/pbtn pin ? 2 c port interrupt portc interrupt on change (pins rc<7:4> only) timer0 over?w a/d timer over?w a/d converter capture event programmable reference comparator interrupt this section addresses the external and timer0 interrupts only. refer to the appropriate sections for description of the serial port, programmable reference and a/d interrupts. intcon records individual interrupt requests in ?g bits. it also has individual and global enable bits. the peripheral interrupt ?gs reside in the pir1 register. peripheral interrupt enable interrupts are contained in the pie1 register. global interrupt masking is controlled by gie (intcon<7>). individual interrupts can be disabled through their corresponding mask bit in the intcon register. gie is cleared on reset to mask interrupts. when an interrupt is serviced, the gie is cleared to disable any further interrupt, the return address is pushed onto the stack and the pc is loaded with 0004h, the interrupt vector. for external interrupt events, such as the i 2 c interrupt, the interrupt latency will be 3 or 4 instruction cycles. the exact latency depends when the interrupt event occurs. the latency is the same for 1 or 2 cycle instructions. once in the interrupt service routine the source(s) of the interrupt can be determined by polling the interrupt ?g bits. the interrupt ?g bit(s) must be cleared in software before re-enabling interrupts to avoid in?ite interrupt requests. individual interrupt ?g bits are set regardless of the status of their corresponding mask bit or the gie bit to allow polling. the return from interrupt instruction, retfie , exits the interrupt routine as well as sets the gie bit to re-enable interrupts. note 1: the individual interrupt ?gs will be set by the speci?d condition even though the corresponding interrupt enable bit is cleared (interrupt disabled) or the gie bit is cleared (all interrupts disabled). note 2: if an interrupt occurs while the global interrupt enable (gie) bit is being cleared, the gie bit may unintentionally be re-enabled by the users interrupt service routine (the retfie instruction). the events that would cause this to occur are: 1. an instruction clears the gie bit while an interrupt is acknowledged. 2. the program branches to the interrupt vector and executes the interrupt service routine. 3. the interrupt service routine completes with the execution of the retfie instruction. this causes the gie bit to be set (enables interrupts), and the program returns to the instruction after the one which was meant to disable interrupts. the method to ensure that interrupts are globally disabled is: 1. ensure that the gie bit was cleared by the instruction, as shown in the following code: loop: bcf intcon,gie ; disable global interrupts btfsc intcon,gie ; global interrupts disabled? goto loop ; no, try again : ; yes, continue with program ; flow figure 10-9: interrupt logic schematic pbif pbie adcif adcie i 2 cif i 2 cie ovfif ovfie cmif cmie t0if t0ie peie wake-up (if in sleep mode) or terminate long write interrupt to cpu peif rcif rcie gie
1996 microchip technology inc. preliminary ds40122b-page 83 pic14000 10.6.1 external interrupt an external interrupt can be generated via the osc1/pbtn pin if in (internal oscillator) mode is enabled. this interrupt is falling edge triggered. when a valid edge appears on osc1/pbtn pin, pbif (pir1<4>) is set. this interrupt can be disabled by clearing pbie (pie1<4>). pbif must be cleared in soft- ware in the interrupt service routine before re-enabling the interrupt. this interrupt can wake up the processor from sleep if pbie bit is set (interrupt enabled) prior to going into sleep mode. the status of the gie bit determines whether or not the processor branches to the interrupt vector following wake-up. the timing of the external interrupt is shown in figure 10-10. figure 10-10: external (osc1/pbtn) interrupt timing q2 q1 q3 q4 q2 q1 q3 q4 q2 q1 q3 q4 q2 q1 q3 q4 q2 q1 q3 q4 internal clkout(3) pbtn pin pbif ?g (pir<4>) gie bit (intcon<7>) instruction flow pc instruction fetched instruction executed interrupt latency pc pc+1 pc+1 0004h 0005h inst (0004h) inst (0005h) dummy cycle inst (pc) inst (pc+1) inst (pc-1) inst (0004h) dummy cycle inst (pc) 1 4 5 1 notes: 1. pbif ?g is sampled here (every q1) 2. interrupt latency = 3-4tcy where tcy = instruction cycle time. latency is the same whether inst (pc) is a single cycle or a 2-cycle instruction. 3. available only in in oscillator mode on osc2. 4. for minimum width spec of pbtn pulse, refer to ac specs. 5. pbif is enabled to be set anytime during the q4-q1 cycles. (note 2) osc
pic14000 ds40122b-page 84 preliminary 1996 microchip technology inc. 10.6.2 timer0 interrupt an over?w (ffh ? 00h) in timer0 will set the t0if (intcon<2>) ?g. setting t0ie (intcon<5>) enables the interrupt. 10.6.3 portc interrupt on change an input change on portc<7:4> sets rcif (pir1<2>). setting rcie (pie1<2>) enables the inter- rupt. for operation of portc, refer to section 5.2. note: if a change on the i/o pin should occur when the read operation is being executed (start of the q2 cycle), then the rcif interrupt ?g may not be set. 10.6.4 context switching during interrupts during an interrupt, only the return pc value is saved on the stack. typically, users may wish to save key registers during an interrupt, for example, w register and status register. example 10-1 is an example that shows saving registers in ram. example 10-1: saving status and w registers in ram movwf w_temp ;copy w to temp register, could be any bank swapf status,w ;swap status to be saved into w bcf status,rp1 ;change to bank zero, regardless of current bank bcf status,rp0 ; movwf status_temp ;save status to bank zero status_temp register : :(isr) : swapf status_temp,w ;swap status_temp register into w ;(sets bank to original state) movwf status ;move w into status register swapf w_temp,f ;swap w_temp swapf w_temp,w ;swap w_temp into w
1996 microchip technology inc. preliminary ds40122b-page 85 pic14000 10.7 w atc hdog timer (wdt) the watchdog timer is realized as a free running on-chip rc oscillator which does not require any external components. this rc oscillator is separate from the in oscillator used to generate the cpu and a/d clocks. that means that the wdt will run even if the clock has been stopped, for example, by execution of a sleep instruction. refer to section 10.8.1 for more information. during normal operation, a wdt time-out generates a device reset. if the device is in sleep mode, a wdt time-out causes the device to wake-up and continue with normal operation. the wdt can be permanently disabled by programming the con?uration bit wdte as a ?? its oscillator can be shut down to conserve battery power by entering hibernate mode. refer to section 10.8.3 for more information on hibernate mode. a block diagram of the watchdog timer is shown in figure 10-11. it should be noted that a reset generated by the wdt time-out does not drive mclr low. caution: beware of disabling wdt if software routines require exiting based on wdt reset. for example, the mcu will not exit hibernate mode based on wdt reset. figure 10-11: watchdog timer block diagram (with timer0) rc3/t0cki t0se 0 1 1 0 pin t0cs f osc /4 sync with internal clocks tmr0 psout (2 cycle delay) psout data bus 8 psa set t0if interrupt on over?w 8-bit counter 8-to-1 mux 18 ms timer psa 0 1 wdt time-out ps2:ps0 8 note: t0cs, t0se, psa, ps2:ps0 correspond to (option<5:0>). psa 0 1 3 hibernate wdt enable bit local oscillator prescaler/ postscaler enable watchdog timer timer0
pic14000 ds40122b-page 86 preliminary 1996 microchip technology inc. 10.7.1 wdt period the wdt has a nominal time-out period of 18 ms (with no prescaler). the time-out periods vary with temperature, v dd and process variations (see dc specs). if longer time-out periods are desired, a pres- caler with a division ratio of up to 1:128 can be assigned to the wdt under software control by writing to the option registers. thus, time-out periods up to 2.3 seconds can be realized. the clrwdt and sleep instructions clear the wdt and the prescaler, if assigned to the wdt, and prevent it from timing out and generating a device reset. the t o bit in the status register will be cleared upon a watchdog timer time-out. the wdt time-out period (no prescaler) is measured and stored in calibration space at location 0fd2h. 10.7.2 wdt programming considerations it should also be taken into account that under worst-case conditions (minimum vdd, maximum temperature, maximum wdt prescaler) it may take several seconds before a wdt time-out occurs. refer to section 6.3 for prescaler switching considerations. 10.8 p o wer mana g ement options the pic14000 has several power management options to prolong battery lifetime. the sleep instruc- tion halts the cpu and can turn off the on-chip oscilla- tors. the cpu can be in sleep mode, yet the a/d converter can continue to run. several bits are included in the slpcon register (8fh) to control power to ana- log modules. table 10-6: summary of power management options function summary cpu clock off during sleep/hibernate mode, on otherwise main oscillator on if not in sleep mode. in sleep mode, controlled by oscoff bit, slpcon<3>. watchdog timer controlled by wdte, 2007h<2> and hiben, slpcon<7> temperature sensor controlled by tempoff, slpcon<1> low-voltage detector controlled by refoff, slpcon<5> comparator and programmable references controlled by cmoff, slpcon<2> a/d comparator controlled by adoff, slpcon<0> programmable current source controlled by adoff, slpcon<0> and adcon1<7:4> slope reference voltage divider controlled by adoff, slpcon<0> level shift networks controlled by lsoff, slpcon<4> bandgap reference controlled by refoff, slpcon<5> voltage regulator control always on. does not consume power if unconnected. power on reset always on, except in sleep/hibernate mode note: refer to analog specs for individual peripheral operating currents.
1996 microchip technology inc. preliminary ds40122b-page 87 pic14000 10.8.1 sleep mode the sleep mode is entered by executing a sleep instruction. if sleep mode is enabled, the wdt will be cleared but keep running. the pd bit in the status register is cleared, the t o bit is set, and on-chip oscillators are shut off, except the wdt rc oscillator, which continues to run. the i/o ports maintain the status they had before the sleep command was executed (driving high, low, or high-impedance). it is an option while in sleep mode to leave the on-chip oscillator running. this option allows an a/d conversion to continue while the cpu is in sleep mode. the cpu clocks are stopped in this condition to preserve power. the operation of the on-chip oscillator during sleep is controlled by oscoff (slpcon<3>). clearing this bit to ? allows the oscil- lator to continue to run. this bit is only active in sleep mode. for lowest power consumption in this mode, all i/o pins should be either at v dd or v ss with no external circuitry drawing current from the i/o pin. i/o pins that are high-impedance inputs should be pulled high or low externally to avoid leakage currents caused by ?ating inputs. the mclr pin must be at a logic high level (v ih ). the contribution from any on-chip pull-up resistors should be considered. 10.8.2 wake-up from sleep the pic14000 can wake up from sleep through one of the following events: 1. external reset input on mclr pin 2. watchdog timer time-out (if wdt is enabled) 3. interrupt from osc1/pbtn pin 4. rc<7:4> port change 5. i 2 c (serial port) start/stop bit detect interrupt. 6. wake-up on programmable reference compara- tor interrupt. 7. a/d conversion complete (comparator trip) inter- rupt. 8. a/d timer over?w interrupt. an external reset on mclr pin causes a device reset. the other wake-up events are considered a continuation of program execution. the t o and pd bits in the status register can be used to determine the cause of device reset. the pd bit, which is set on power-up is cleared when sleep is invoked. the t o bit is cleared if a wdt time-out occurred (and caused a wake-up). when the sleep instruction is being executed, the next instruction ( pc + 1 ) is pre-fetched. for the device to wake-up through an interrupt event, the corresponding interrupt enable bit must be set. wake-up occurs regardless of the state of bit gie. if bit gie is clear, the device continues execution at the instruction after the sleep instruction. if bit gie is set, the device executes the instruction after the sleep instruction and then branches to the interrupt address (0004h). in cases where the execution of the instruction following sleep is not desirable, the user should have a nop after the sleep instruction. the wdt is cleared when the device wakes-up from sleep, regardless of the source of wake-up. note: if the global interrupts are disabled (gie is cleared), but any interrupt source has both its interrupt enable bit and the corresponding interrupt ?g bits set, the device will immediately wake from sleep. 10.8.3 hibernate mode hibernate mode is an extension of sleep mode with the following additions. wdt is forced off weak pull-ups on rc<5:0> are disabled some input buffers are gated-off (refer to section 5.0) the hibernate mode is entered by executing a sleep instruction with hiben (slpcon<7>) bit set. the pic14000 wakes up from hibernate mode via all the same mechanisms as sleep mode, except for wdt time-out. hibernate mode allows power con- sumption to be reduced to a minimum.
pic14000 ds40122b-page 88 preliminary 1996 microchip technology inc. figure 10-12: slpcon register 8fh bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 slpcon hiben refoff lsoff oscoff cmoff tempoff adoff read/write r/w u r/w r/w r/w r/w r/w r/w por value 3fh 00111111 bit name function b7 hiben hibernate mode select 1 = hibernate mode enable 0 = normal operating mode b6 unimplemented. read as ? b5 refoff references power control (bandgap reference, low voltage detector, bias generator) 1 = the references are off 0 = the references are on b4 lsoff level shift network power control 1 = the level shift network is off. the ra1/an1, rd5/an5 inputs can continue to function as either analog or digital. 0 = the level shift network is on. the signals at the ra1/an1, rd5/an5 inputs are level shifted by approximately 0.5v. b3 oscoff main oscillator power control 1 = the main oscillator is disabled during sleep mode 0 = the main oscillator is running during sleep mode for a/d conversions to continue b2 cmoff programmable reference and comparator power control 1 = the programmable reference and comparator circuits are off 0 = the programmable reference and comparator circuits are on b1 tempoff on-chip temperature sensor power control 1 = the temperature sensor is off 0 = the temperature sensor is on b0 adoff a/d module power control (comparator, programmable current source, slope reference voltage divider) 1 = the a/d module power is off 0 = the a/d module power is on
1996 microchip technology inc. preliminary ds40122b-page 89 pic14000 figure 10-13: wake-up from sleep and hibernate through interrupt note 1: hs oscillator mode assumed. 2: t ost = 1024 t osc (drawing not to scale). this delay will be 8 t osc for in osc mode. 3: gie = 1 assumed. in this case after wake up processor jumps to interrupt routine. if gie = 0, execution will continue in line. 4: clkout is not available in these osc modes, but shown here for timing reference. 5: refer to section 10.8 for sources. q1 q2 q3 q4 q1 q2 q3 q4 q1 q1 q2 q3 q4 q1 q2 q3 q4 q1 q2 q3 q4 q1 q2 q3 q4 osc1 clkout(4) interrupt gie bit (intcon<7>) instruction flow pc instruction fetched instruction executed pc pc+1 pc+2 inst(pc) = sleep inst(pc - 1) inst(pc + 1) sleep processor in sleep interrupt latency (note 2) inst(pc + 2) inst(pc + 1) inst(0004h) inst(0005h) inst(0004h) dummy cycle pc + 2 0004h 0005h dummy cycle t ost (2) flag (5) 10.9 code pr otection the code in the program memory can be protected by programming the code protect bits. when code protected, the contents of the program memory cannot be read out. in code-protected mode, the con?uration word (2007h) will not be scrambled, allowing reading of all con?uration bits. 10.10 in-cir cuit serial pr ogramming pic14000 can be serially programmed while in the end application circuit. this is simply done with two lines for clock and data, and three other lines for power, ground and the programming voltage. this allows customers to manufacture boards with unprogrammed devices, and then program the microcontroller just before shipping the product. this allows the most recent ?mware or a custom ?mware to be programmed. the device is placed into a program/verify mode by holding the rc6/scl and rc7/sda pins low while raising the mclr (v pp ) pin from v il to v ih . rc6 then becomes the programming clock and rc7 becomes the programmed data. both rc6 and rc7 are schmitt trigger inputs in this mode. after reset, to place the device into programming/verify mode, the program counter (pc) is at location 00h. a 6-bit command is then supplied to the device. depending on the command, 14-bits of program data are then supplied to or from the device. for complete details about serial programming, please refer to the pic16c6x/7x programming speci?ations (literature #ds30228). a typical in-system serial programming connection is shown in figure 10-14. figure 10-14: typical in-system serial programming connection external connector signals to normal connections to normal connections pic14000 v dd v ss mclr /v pp rc6 rc7 +5v 0v vpp clk data i/o v dd
pic14000 ds40122b-page 90 preliminary 1996 microchip technology inc. notes:
1996 microchip technology inc. preliminary ds40122b-page 91 pic14000 11.0 instruction set summary the pic14000s instruction set is the same as pic16cxx. each instruction is a 14-bit word divided into an opcode which speci?s the instruction type and one or more operands which further specify the operation of the instruction. the instruction set sum- mary in table 11-2 lists byte-oriented, bit-oriented, and literal and control operations. table 11-1 shows the opcode ?ld descriptions. for byte-oriented instructions, 'f' represents a ?e reg- ister designator and 'd' represents a destination desig- nator. the ?e register designator speci?s which ?e register is to be used by the instruction. the destination designator speci?s where the result of the operation is to be placed. if 'd' is zero, the result is placed in the w register. if 'd' is one, the result is placed in the ?e register speci?d in the instruction. for bit-oriented instructions, 'b' represents a bit ?ld designator which selects the number of the bit affected by the operation, while 'f' represents the number of the ?e in which the bit is located. for literal and control operations, 'k' represents an eight or eleven bit constant or literal value. table 11-1: opcode field descriptions field description f register ?e address (0x00 to 0x7f) w working register (accumulator) b bit address within an 8-bit ?e register k literal ?ld, constant data or label x don't care location (= 0 or 1) the assembler will generate code with x = 0. it is the recommended form of use for compatibility with all microchip software tools. d destination select; d = 0: store result in w, d = 1: store result in ?e register f. default is d = 1 label label name tos top of stack pc program counter pclath program counter high latch gie global interrupt enable bit wdt watchdog timer/counter to time-out bit pd power-down bit dest destination either the w register or the speci?d register ?e location [ ] options ( ) contents ? assigned to < > register bit ?ld ? in the set of i talics user de?ed term (font is courier) the instruction set is highly orthogonal and is grouped into three basic categories: byte-oriented operations bit-oriented operations literal and control operations all instructions are executed within one single instruc- tion cycle, unless a conditional test is true or the pro- gram counter is changed as a result of an instruction. in this case, the execution takes two instruction cycles with the second cycle executed as a nop. one instruc- tion cycle consists of four oscillator periods. thus, for an oscillator frequency of 4 mhz, the normal instruction execution time is 1 m s. if a conditional test is true or the program counter is changed as a result of an instruc- tion, the instruction execution time is 2 m s. table 11-2 lists the instructions recognized by the mpasm assembler. figure 11-1 shows the three general formats that the instructions can have. all examples use the following format to represent a hexadecimal number: 0xhh where h signi?s a hexadecimal digit. figure 11-1: general format for instructions note: to maintain upward compatibility with future pic16cxx products, do not use the option and tris instructions. byte-oriented ?e register operations 13 8 7 6 0 d = 0 for destination w opcode d f (file #) d = 1 for destination f f = 7-bit ?e register address bit-oriented ?e register operations 13 10 9 7 6 0 opcode b (bit #) f (file #) b = 3-bit bit address f = 7-bit ?e register address literal and control operations 13 8 7 0 opcode k (literal) k = 8-bit immediate value 13 11 10 0 opcode k (literal) k = 11-bit immediate value general call and goto instructions only this document was created with framemake r404
pic14000 ds40122b-page 92 preliminary 1996 microchip technology inc. table 11-2: pic14000 instruction set mnemonic, operands description cycles 14-bit opcode status affected notes msb lsb byte-oriented file register operations addwf andwf clrf clrw comf decf decfsz incf incfsz iorwf movf movwf nop rlf rrf subwf swapf xorwf f, d f, d f - f, d f, d f, d f, d f, d f, d f, d f - f, d f, d f, d f, d f, d add w and f and w with f clear f clear w complement f decrement f decrement f, skip if 0 increment f increment f, skip if 0 inclusive or w with f move f move w to f no operation rotate left f through carry rotate right f through carry subtract w from f swap nibbles in f exclusive or w with f 1 1 1 1 1 1 1(2) 1 1(2) 1 1 1 1 1 1 1 1 1 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0111 0101 0001 0001 1001 0011 1011 1010 1111 0100 1000 0000 0000 1101 1100 0010 1110 0110 dfff dfff lfff 0xxx dfff dfff dfff dfff dfff dfff dfff lfff 0xx0 dfff dfff dfff dfff dfff ffff ffff ffff xxxx ffff ffff ffff ffff ffff ffff ffff ffff 0000 ffff ffff ffff ffff ffff c,dc,z z z z z z z z z c c c,dc,z z 1,2 1,2 2 1,2 1,2 1,2,3 1,2 1,2,3 1,2 1,2 1,2 1,2 1,2 1,2 1,2 bit-oriented file register operations bcf bsf btfsc btfss f, b f, b f, b f, b bit clear f bit set f bit test f, skip if clear bit test f, skip if set 1 1 1 (2) 1 (2) 01 01 01 01 00bb 01bb 10bb 11bb bfff bfff bfff bfff ffff ffff ffff ffff 1,2 1,2 3 3 literal and control operations addlw andlw call clrwdt goto iorlw movlw retfie retlw return sleep sublw xorlw k k k - k k k - k - - k k add literal and w and literal with w call subroutine clear watchdog timer go to address inclusive or literal with w move literal to w return from interrupt return with literal in w return from subroutine go into standby mode subtract w from literal exclusive or literal with w 1 1 2 1 2 1 1 2 2 2 1 1 1 11 11 10 00 10 11 11 00 11 00 00 11 11 111x 1001 0kkk 0000 1kkk 1000 00xx 0000 01xx 0000 0000 110x 1010 kkkk kkkk kkkk 0110 kkkk kkkk kkkk 0000 kkkk 0000 0110 kkkk kkkk kkkk kkkk kkkk 0100 kkkk kkkk kkkk 1001 kkkk 1000 0011 kkkk kkkk c,dc,z z t o , pd z t o , pd c,dc,z z note 1: when an i/o register is modi?d as a function of itself ( e.g., movf portb, 1 ), the value used will be that value present on the pins themselves. for example, if the data latch is '1' for a pin con?ured as input and is driven low by an external device, the data will be written back with a '0'. 2: if this instruction is executed on the tmr0 register (and, where applicable, d = 1), the prescaler will be cleared if assigned to the timer0 module. 3: if program counter (pc) is modi?d or a conditional test is true, the instruction requires two cycles. the second cycle is executed as a nop.
1996 microchip technology inc. preliminary ds40122b-page 93 pic14000 11.1 instruction descriptions addlw add literal and w syntax: [ label ] addlw k operands: 0 k 255 operation: (w) + k ? (w) status affected: c, dc, z encoding: 11 111x kkkk kkkk description: the contents of the w register are added to the eight bit literal 'k' and the result is placed in the w register . words: 1 cycles: 1 example addlw 0x15 before instruction w = 0x10 after instruction w = 0x25 addwf add w and f syntax: [ label ] addwf f,d operands: 0 f 127 d ? [0,1] operation: (w) + (f) ? (dest) status affected: c, dc, z encoding: 00 0111 dfff ffff description: add the contents of the w register with register 'f'. if 'd' is 0 the result is stored in the w register. if 'd' is 1 the result is stored back in register 'f' . words: 1 cycles: 1 example addwf fsr, 0 before instruction w = 0x17 fsr = 0xc2 after instruction w = 0xd9 fsr = 0xc2 andlw and literal with w syntax: [ label ] andlw k operands: 0 k 255 operation: (w) .and. (k) ? (w) status affected: z encoding: 11 1001 kkkk kkkk description: the contents of w register are and?d with the eight bit literal 'k'. the result is placed in the w register . words: 1 cycles: 1 example andlw 0x5f before instruction w = 0xa3 after instruction w = 0x03 andwf and w with f syntax: [ label ] andwf f,d operands: 0 f 127 d ? [0,1] operation: (w) .and. (f) ? (dest) status affected: z encoding: 00 0101 dfff ffff description: and the w register with register 'f'. if 'd' is 0 the result is stored in the w register. if 'd' is 1 the result is stored back in register 'f' . words: 1 cycles: 1 example andwf fsr, 1 before instruction w = 0x17 fsr = 0xc2 after instruction w = 0x17 fsr = 0x02
pic14000 ds40122b-page 94 preliminary 1996 microchip technology inc. bcf bit clear f syntax: [ label ] bcf f,b operands: 0 f 127 0 b 7 operation: 0 ? (f) status affected: none encoding: 01 00bb bfff ffff description: bit 'b' in register 'f' is cleared . words: 1 cycles: 1 example bcf flag_reg, 7 before instruction flag_reg = 0xc7 after instruction flag_reg = 0x47 bsf bit set f syntax: [ label ] bsf f,b operands: 0 f 127 0 b 7 operation: 1 ? (f) status affected: none encoding: 01 01bb bfff ffff description: bit 'b' in register 'f' is set. words: 1 cycles: 1 example bsf flag_reg, 7 before instruction flag_reg = 0x0a after instruction flag_reg = 0x8a btfsc bit test, skip if clear syntax: [ label ] btfsc f,b operands: 0 f 127 0 b 7 operation: skip if (f) = 0 status affected: none encoding: 01 10bb bfff ffff description: if bit 'b' in register 'f' is '0' then the next instruction is skipped. if bit 'b' is '0' then the next instruction fetched during the current instruction execution is discarded, and a nop is executed instead, making this a 2 cycle instruction . words: 1 cycles: 1(2) example here false true btfsc goto flag,1 process_code before instruction pc = address here after instruction if flag<1> = 0, pc = address true if flag<1>=1, pc = address false
1996 microchip technology inc. preliminary ds40122b-page 95 pic14000 btfss bit test f, skip if set syntax: [ label ] btfss f,b operands: 0 f 127 0 b < 7 operation: skip if (f) = 1 status affected: none encoding: 01 11bb bfff ffff description: if bit 'b' in register 'f' is '1' then the next instruction is skipped. if bit 'b' is '1', then the next instruction fetched during the current instruction execution, is discarded and a nop is executed instead, making this a 2 cycle instruction. words: 1 cycles: 1(2) example here false true btfsc goto flag,1 process_code before instruction pc = address here after instruction if flag<1> = 0, pc = address false if flag<1> = 1, pc = address true call call subroutine syntax: [ label ] call k operands: 0 k 2047 operation: (pc)+ 1 ? tos, k ? pc<10:0>, (pclath<4:3>) ? pc<12:11> status affected: none encoding: 10 0kkk kkkk kkkk description: call subroutine. first, return address (pc+1) is pushed onto the stack. the eleven bit immediate address is loaded into pc bits <10:0>. the upper bits of the pc are loaded from pclath. call is a two cycle instruction. words: 1 cycles: 2 example here call there before instruction pc = address here after instruction pc = address there tos = address here+1 clrf clear f syntax: [ label ] clrf f operands: 0 f 127 operation: 00h ? (f) 1 ? z status affected: z encoding: 00 0001 1fff ffff description: the contents of register 'f' are cleared and the z bit is set. words: 1 cycles: 1 example clrf flag_reg before instruction flag_reg = 0x5a after instruction flag_reg = 0x00 z=1 clrw clear w syntax: [ label ] clrw operands: none operation: 00h ? (w) 1 ? z status affected: z encoding: 00 0001 0xxx xxxx description: w register is cleared. zero bit (z) is set. words: 1 cycles: 1 example clrw before instruction w = 0x5a after instruction w = 0x00 z=1
pic14000 ds40122b-page 96 preliminary 1996 microchip technology inc. clrwdt clear watchdog timer syntax: [ label ] clrwdt operands: none operation: 00h ? wdt 0 ? wdt prescaler, 1 ? t o 1 ? pd status affected: t o , pd encoding: 00 0000 0110 0100 description: clrwdt instruction resets the watch- dog timer. it also resets the prescaler of the wdt. status bits t o and pd are set. words: 1 cycles: 1 example clrwdt before instruction wdt counter = ? after instruction wdt counter = 0x00 wdt prescaler = 0 t o =1 pd =1 comf complement f syntax: [ label ] comf f,d operands: 0 f 127 d ? [0,1] operation: (f ) ? (dest) status affected: z encoding: 00 1001 dfff ffff description: the contents of register 'f' are comple- mented. if 'd' is 0 the result is stored in w. if 'd' is 1 the result is stored back in register 'f'. words: 1 cycles: 1 example comf reg1,0 before instruction reg1 = 0x13 after instruction reg1 = 0x13 w = 0xec decf decrement f syntax: [ label ] decf f,d operands: 0 f 127 d ? [0,1] operation: (f) - 1 ? (dest) status affected: z encoding: 00 0011 dfff ffff description: decrement register 'f'. if 'd' is 0 the result is stored in the w register. if 'd' is 1 the result is stored back in register 'f' . words: 1 cycles: 1 example decf cnt, 1 before instruction cnt = 0x01 z=0 after instruction cnt = 0x00 z=1 decfsz decrement f, skip if 0 syntax: [ label ] decfsz f,d operands: 0 f 127 d ? [0,1] operation: (f) - 1 ? (dest); skip if result = 0 status affected: none encoding: 00 1011 dfff ffff description: the contents of register 'f' are decre- mented. if 'd' is 0 the result is placed in the w register. if 'd' is 1 the result is placed back in register 'f'. if the result is 0, the next instruction, which is already fetched, is discarded. a nop is executed instead making it a two cycle instruction. words: 1 cycles: 1(2) example here decfsz cnt, 1 goto loop continue before instruction pc = address here after instruction cnt = cnt - 1 if cnt = 0, pc = address continue if cnt 1 0, pc = address here+1
1996 microchip technology inc. preliminary ds40122b-page 97 pic14000 goto unconditional branch syntax: [ label ] goto k operands: 0 k 2047 operation: k ? pc<10:0> pclath<4:3> ? pc<12:11> status affected: none encoding: 10 1kkk kkkk kkkk description: goto is an unconditional branch. the eleven bit immediate value is loaded into pc bits <10:0>. the upper bits of pc are loaded from pclath<4:3>. goto is a two cycle instruction. words: 1 cycles: 2 example goto there after instruction pc = address there incf increment f syntax: [ label ] incf f,d operands: 0 f 127 d ? [0,1] operation: (f) + 1 ? (dest) status affected: z encoding: 00 1010 dfff ffff description: the contents of register 'f' are incre- mented. if 'd' is 0 the result is placed in the w register. if 'd' is 1 the result is placed back in register 'f'. words: 1 cycles: 1 example incf cnt, 1 before instruction cnt = 0xff z=0 after instruction cnt = 0x00 z=1 incfsz increment f, skip if 0 syntax: [ label ] incfsz f,d operands: 0 f 127 d ? [0,1] operation: (f) + 1 ? (dest), skip if result = 0 status affected: none encoding: 00 1111 dfff ffff description: the contents of register 'f' are incre- mented. if 'd' is 0 the result is placed in the w register. if 'd' is 1 the result is placed back in register 'f'. if the result is 0, the next instruction, which is already fetched, is discarded. a nop is executed instead making it a two cycle instruction . words: 1 cycles: 1(2) example here incfsz cnt, 1 goto loop continue before instruction pc = address here after instruction cnt = cnt + 1 if cnt= 0, pc = address continue if cnt 1 0, pc = address here +1 iorlw inclusive or literal with w syntax: [ label ] iorlw k operands: 0 k 255 operation: (w) .or. k ? (w) status affected: z encoding: 11 1000 kkkk kkkk description: the contents of the w register is or?d with the eight bit literal 'k'. the result is placed in the w register . words: 1 cycles: 1 example iorlw 0x35 before instruction w = 0x9a after instruction w = 0xbf z=1
pic14000 ds40122b-page 98 preliminary 1996 microchip technology inc. iorwf inclusive or w with f syntax: [ label ] iorwf f,d operands: 0 f 127 d ? [0,1] operation: (w) .or. (f) ? (dest) status affected: z encoding: 00 0100 dfff ffff description: inclusive or the w register with regis- ter 'f'. if 'd' is 0 the result is placed in the w register. if 'd' is 1 the result is placed back in register 'f'. words: 1 cycles: 1 example iorwf result, 0 before instruction result = 0x13 w = 0x91 after instruction result = 0x13 w = 0x93 z=1 movlw move literal to w syntax: [ label ] movlw k operands: 0 k 255 operation: k ? (w) status affected: none encoding: 11 00xx kkkk kkkk description: the eight bit literal 'k' is loaded into w register . the don? cares will assemble as 0s. words: 1 cycles: 1 example movlw 0x5a after instruction w = 0x5a movf move f syntax: [ label ] movf f,d operands: 0 f 127 d ? [0,1] operation: (f) ? (dest) status affected: z encoding: 00 1000 dfff ffff description: the contents of register f is moved to a destination dependant upon the sta- tus of d. if d = 0, destination is w reg- ister. if d = 1, the destination is ?e register f itself. d = 1 is useful to test a ?e register since status ?g z is affected. words: 1 cycles: 1 example movf fsr, 0 after instruction w = value in fsr register z= 1 movwf move w to f syntax: [ label ] movwf f operands: 0 f 127 operation: (w) ? (f) status affected: none encoding: 00 0000 1fff ffff description: move data from w register to register 'f' . words: 1 cycles: 1 example movwf option before instruction option = 0xff w = 0x4f after instruction option = 0x4f w = 0x4f
1996 microchip technology inc. preliminary ds40122b-page 99 pic14000 nop no operation syntax: [ label ] nop operands: none operation: no operation status affected: none encoding: 00 0000 0xx0 0000 description: no operation. words: 1 cycles: 1 example nop option load option register syntax: [ label ] option operands: none operation: (w) ? option status affected: none encoding: 00 0000 0110 0010 description: the contents of the w register are loaded in the option register. this instruction is supported for code com- patibility with pic16c5x products. since option is a readable/writable register, the user can directly address it. words: 1 cycles: 1 example to maintain upward compatibility with future pic16cxx products, do not use this instruction. retfie return from interrupt syntax: [ label ] retfie operands: none operation: tos ? pc, 1 ? gie status affected: none encoding: 00 0000 0000 1001 description: return from interrupt. stack is poped and top of stack (tos) is loaded in the pc. interrupts are enabled by set- ting global interrupt enable bit, gie (intcon<7>). this is a two cycle instruction. words: 1 cycles: 2 example retfie after interrupt pc = tos gie = 1 retlw return with literal in w syntax: [ label ] retlw k operands: 0 k 255 operation: k ? (w); tos ? pc status affected: none encoding: 11 01xx kkkk kkkk description: the w register is loaded with the eight bit literal 'k'. the program counter is loaded from the top of the stack (the return address). this is a two cycle instruction. words: 1 cycles: 2 example table call table ;w contains table ;offset value ? ;w now has table value addwf pc ;w = offset retlw k1 ;begin table retlw k2 ; retlw kn ; end of table before instruction w = 0x07 after instruction w = value of k8
pic14000 ds40122b-page 100 preliminary 1996 microchip technology inc. return return from subroutine syntax: [ label ] return operands: none operation: tos ? pc status affected: none encoding: 00 0000 0000 1000 description: return from subroutine. the stack is poped and the top of the stack (tos) is loaded into the program counter. this is a two cycle instruction. words: 1 cycles: 2 example return after interrupt pc = tos rlf rotate left f through carry syntax: [ label ] rlf f,d operands: 0 f 127 d ? [0,1] operation: see description below status affected: c encoding: 00 1101 dfff ffff description: the contents of register 'f' are rotated one bit to the left through the carry flag. if 'd' is 0 the result is placed in the w register. if 'd' is 1 the result is stored back in register 'f'. words: 1 cycles: 1 example rlf reg1,0 before instruction reg1 = 1110 0110 c =0 after instruction reg1 = 1110 0110 w = 1100 1100 c =1 register f c rrf rotate right f through carry syntax: [ label ] rrf f,d operands: 0 f 127 d ? [0,1] operation: see description below status affected: c encoding: 00 1100 dfff ffff description: the contents of register 'f' are rotated one bit to the right through the carry flag. if 'd' is 0 the result is placed in the w register. if 'd' is 1 the result is placed back in register 'f'. words: 1 cycles: 1 example rrf reg1,0 before instruction reg1 = 1110 0110 c =0 after instruction reg1 = 1110 0110 w = 0111 0011 c =0 sleep syntax: [ label ] sleep operands: none operation: 00h ? wdt, 0 ? wdt prescaler, 1 ? t o , 0 ? pd status affected: t o , pd encoding: 00 0000 0110 0011 description: the power-down status bit, p d is cleared. time-out status bit, t o is set. watchdog timer and its pres- caler are cleared. the processor is put into sleep mode with the oscillator stopped. see section 10.8 for more details. words: 1 cycles: 1 example: sleep register f c
1996 microchip technology inc. preliminary ds40122b-page 101 pic14000 sublw subtract w from literal syntax: [ label ] sublw k operands: 0 k 255 operation: k - (w) ? ( w) status affected: c, dc, z encoding: 11 110x kkkk kkkk description: the w register is subtracted (2s com- plement method) from the eight bit literal 'k'. the result is placed in the w register. words: 1 cycles: 1 example 1: sublw 0x02 before instruction w= 1 c= ? after instruction w= 1 c = 1; result is positive example 2: before instruction w= 2 c= ? after instruction w= 0 c = 1; result is zero example 3: before instruction w= 3 c= ? after instruction w = 0xff c = 0; result is nega- tive subwf subtract w from f syntax: [ label ] subwf f,d operands: 0 f 127 d ? [0,1] operation: (f) - (w) ? ( dest) status affected: c, dc, z encoding: 00 0010 dfff ffff description: subtract (2s complement method) w reg- ister from register 'f'. if 'd' is 0 the result is stored in the w register. if 'd' is 1 the result is stored back in register 'f'. words: 1 cycles: 1 example 1: subwf reg1,1 before instruction reg1 = 3 w=2 c=? after instruction reg1 = 1 w=2 c = 1; result is positive example 2: before instruction reg1 = 2 w=2 c=? after instruction reg1 = 0 w=2 c = 1; result is zero example 3: before instruction reg1 = 1 w=2 c=? after instruction reg1 = 0xff w=2 c = 0; result is negative
pic14000 ds40122b-page 102 preliminary 1996 microchip technology inc. swapf swap nibbles in f syntax: [ label ] swapf f,d operands: 0 f 127 d ? [0,1] operation: (f<3:0>) ? (dest<7:4>), (f<7:4>) ? (dest<3:0>) status affected: none encoding: 00 1110 dfff ffff description: the upper and lower nibbles of regis- ter 'f' are exchanged. if 'd' is 0 the result is placed in w register. if 'd' is 1 the result is placed in register 'f'. words: 1 cycles: 1 example swapf reg, 0 before instruction reg1 = 0xa5 after instruction reg1 = 0xa5 w = 0x5a tris load tris register syntax: [ label ] tris f operands: 5 f 7 operation: (w) ? tris register f; status affected: none encoding: 00 0000 0110 0fff description: the instruction is supported for code compatibility with the pic16c5x prod- ucts. since tris registers are read- able and writable, the user can directly address them. words: 1 cycles: 1 example to maintain upward compatibility with future pic16cxx products, do not use this instruction. xorlw exclusive or literal with w syntax: [ label ] xorlw k operands: 0 k 255 operation: (w) .xor. k ? ( w) status affected: z encoding: 11 1010 kkkk kkkk description: the contents of the w register are xor?d with the eight bit literal 'k'. the result is placed in the w regis- ter. words: 1 cycles: 1 example: xorlw 0xaf before instruction w = 0xb5 after instruction w = 0x1a xorwf exclusive or w with f syntax: [ label ] xorwf f,d operands: 0 f 127 d ? [0,1] operation: (w) .xor. (f) ? ( dest) status affected: z encoding: 00 0110 dfff ffff description: exclusive or the contents of the w register with register 'f'. if 'd' is 0 the result is stored in the w register. if 'd' is 1 the result is stored back in register 'f'. words: 1 cycles: 1 example xorwf reg 1 before instruction reg = 0xaf w = 0xb5 after instruction reg = 0x1a w = 0xb5
1996 microchip technology inc. preliminary ds40122b-page 103 pic14000 12.0 development support 12.1 de velopme nt t ools the pic16/17 microcontrollers are supported with a full range of hardware and software development tools: picmaster/picmaster ce real-time in-circuit emulator icepic low-cost pic16c5x and pic16cxx in-circuit emulator pro mate ii universal programmer picstart plus entry-level prototype programmer picdem-1 low-cost demonstration board picdem-2 low-cost demonstration board picdem-3 low-cost demonstration board mpasm assembler mplab-sim software simulator mplab-c (c compiler) fuzzy logic development system (fuzzytech - mp) 12.2 picmaster: high p erf ormance univer sal in-cir cuit em ulator with mplab ide the picmaster universal in-circuit emulator is intended to provide the product development engineer with a complete microcontroller design tool set for all microcontrollers in the pic12c5xx, pic14000, pic16c5x, pic16cxx and pic17cxx families. picmaster is supplied with the mplab integrated development environment (ide), which allows editing, ?ake?and download, and source debugging from a single environment. interchangeable target probes allow the system to be easily recon?ured for emulation of different proces- sors. the universal architecture of the picmaster allows expansion to support all new microchip micro- controllers. the picmaster emulator system has been designed as a real-time emulation system with advanced features that are generally found on more expensive development tools. the pc compatible 386 (and higher) machine platform and microsoft windows 3.x environment were chosen to best make these fea- tures available to you, the end user. a ce compliant version of picmaster is available for european union (eu) countries. 12.3 i cepic: lo w-cost pic16cxx in-cir cuit em ulator icepic is a low-cost in-circuit emulator solution for the microchip pic16c5x and pic16cxx families of 8-bit otp microcontrollers. icepic is designed to operate on pc-compatible machines ranging from 286-at through pentium based machines under windows 3.x environment. icepic features real time, non-intrusive emulation. 12.4 pr o ma te ii: univer sal pr ogrammer the pro mate ii universal programmer is a full-fea- tured programmer capable of operating in stand-alone mode as well as pc-hosted mode. the pro mate ii has programmable v dd and v pp supplies which allows it to verify programmed memory at v dd min and v dd max for maximum reliability. it has an lcd display for displaying error messages, keys to enter commands and a modular detachable socket assembly to support various package types. in stand- alone mode the pro mate ii can read, verify or pro- gram pic16c5x, pic16cxx, pic17cxx and pic14000 devices. it can also set con?uration and code-protect bits in this mode. 12.5 p icst ar t plus entr y le vel de velopment system the picstart programmer is an easy-to-use, low- cost prototype programmer. it connects to the pc via one of the com (rs-232) ports. mplab integrated development environment software makes using the programmer simple and ef?ient. picstart plus is not recommended for production programming. picstart plus supports all pic12c5xx, pic14000, pic16c5x, pic16cxx and pic17cxx devices with up to 40 pins. larger pin count devices such as the pic16c923 and pic16c924 may be supported with an adapter socket. this document was created with framemake r404
pic14000 ds40122b-page 104 preliminary 1996 microchip technology inc. 12.6 picdem-1 lo w-cost pic16/17 demonstration boar d the picdem-1 is a simple board which demonstrates the capabilities of several of microchips microcontrol- lers. the microcontrollers supported are: pic16c5x (pic16c54 to pic16c58a), pic16c61, pic16c62x, pic16c71, pic16c8x, pic17c42, pic17c43 and pic17c44. all necessary hardware and software is included to run basic demo programs. the users can program the sample micro controllers provided with the picdem-1 board, on a pro mate ii or picstart-16b programmer, and easily test ?m- ware. the user can also connect the picdem-1 board to the picmaster emulator and down load the ?mware to the emulator for testing. additional pro- totype area is available for the user to build some addi- tional hardware and connect it to the microcontroller socket(s). some of the features include an rs-232 interface, a potentiometer for simulated analog input, push-button switches and eight leds connected to portb. 12.7 picdem-2 lo w-cost pic16cxx demonstration boar d the picdem-2 is a simple demonstration board that supports the pic16c62, pic16c64, pic16c65, pic16c73 and pic16c74 microcon trollers. all the necessary hardware and software is included to run the basic demonstration programs. the user can program the sample microcontrollers provided with the picdem-2 board, on a pro mate ii pro- grammer or picstart-16c, and easily test ?mware. the picmaster emulator may also be used with the picdem-2 board to test ?mware. additional prototype area has been provided to the user for adding addi- tional hardware and connecting it to the microcontroller socket(s). some of the features include a rs-232 inter- face, push-button switches, a potentiometer for simu- lated analog input, a serial eeprom to demonstrate usage of the i 2 c bus and separate headers for connec- tion to an lcd module and a keypad. 12.8 picdem-3 lo w-cost pic16cxx demonstration boar d the picdem-3 is a simple demonstration board that supports the pic16c923 and pic16c924 in the plcc package. it will also support future 44-pin plcc microcontrollers with a lcd module. all the neces- sary hardware and software is included to run the basic demonstration programs. the user can pro- gram the sample microcontrollers provided with the picdem-3 board, on a pro mate ii program- mer or picstart plus with an adapter socket, and easily test ?mware. the picmaster emulator may also be used with the picdem-3 board to test ?m- ware. additional prototype area has been provided to the user for adding hardware and connecting it to the microcontroller socket(s). some of the features include an rs-232 interface, push-button switches, a potentiometer for simulated analog input, a thermistor and separate headers for connection to an external lcd module and a keypad. also provided on the pic- dem-3 board is an lcd panel, with 4 commons and 12 segments, that is capable of displaying time, tempera- ture and day of the week. the picdem-3 provides an additional rs-232 interface and windows 3.1 software for showing the demultiplexed lcd signals on a pc. a simple serial interface allows the user to construct a hardware demultiplexer for the lcd signals. picdem- 3 will be available in the 3rd quarter of 1996. 12.9 mplab integrated de velopment en vir onment softwar e the mplab ide software brings an ease of software development previously unseen in the 8-bit microcon- troller market. mplab is a windows based application which contains: a full featured editor three operating modes - editor - emulator - simulator a project manager customizable tool bar and key mapping a status bar with project information extensive on-line help mplab allows you to: edit your source ?es (either assembly or ?? one touch assemble (or compile) and download to pic16/17 tools (automatically updates all project information) debug using: - source ?es - absolute listing ?e transfer data dynamically via dde (soon to be replaced by ole) run up to four emulators on the same pc the ability to use mplab with microchips simulator allows a consistent platform and the ability to easily switch from the low cost simulator to the full featured emulator with minimal retraining due to development tools. 12.10 assemb ler (mp asm) the mpasm universal macro assembler is a pc- hosted symbolic assembler. it supports all microcon- troller series including the pic12c5xx, pic14000, pic16c5x, pic16cxx, and pic17cxx families. mpasm offers full featured macro capabilities, condi- tional assembly, and several source and listing formats. it generates various object code formats to support microchip's development tools as well as third party programmers.
1996 microchip technology inc. preliminary ds40122b-page 105 pic14000 mpasm allows full symbolic debugging from the micro chip universal emulator system (picmaster). mpasm has the following features to assist in develop- ing software for speci? use applications. provides translation of assembler source code to object code for all microchip microcontrollers. macro assembly capability. produces all the ?es (object, listing, symbol, and special) required for symbolic debug with microchips emulator systems. supports hex (default), decimal and octal source and listing formats. mpasm provides a rich directive language to support programming of the pic16/17. directives are helpful in making the development of your assemble source code shorter and more maintainable. 12.11 s oftware sim ulator (mplab-sim) the mplab-sim software simulator allows code development in a pc host environment. it allows the user to simulate the pic16/17 series microcontrollers on an instruction level. on any given instruction, the user may examine or modify any of the data areas or provide external stimulus to any of the pins. the input/ output radix can be set by the user and the execution can be performed in; single step, execute until break, or in a trace mode. mplab-sim fully supports symbolic debugging using mplab-c and mpasm. the software simulator offers the low cost ?xibility to develop and debug code out- side of the laboratory environment making it an excel- lent multi-project software development tool. 12.12 c compiler ( mplab-c) the mplab-c code development system is a com- plete ? compiler and integrated development environ- ment for microchips pic16/17 family of microcontrollers. the compiler provides powerful inte- gration capabilities and ease of use not found with other compilers. for easier source level debugging, the compiler pro- vides symbol information that is compatible with the mplab ide memory display (picmaster emulator software versions 1.13 and later). 12.13 fuzzy logic de velopment system ( fuzzy tech-mp) fuzzy tech-mp fuzzy logic development tool is avail- able in two versions - a low cost introductory version, mp explorer, for designers to gain a comprehensive working knowledge of fuzzy logic system design; and a full-featured version, fuzzy tech-mp, edition for imple- menting more complex systems. both versions include microchips fuzzy lab demon- stration board for hands-on experience with fuzzy logic systems implementation. 12.14 mp-drivew a y ?application code generator mp-driveway is an easy-to-use windows-based appli- cation code generator. with mp-driveway you can visually con?ure all the peripherals in a pic16/17 device and, with a click of the mouse, generate all the initialization and many functional code modules in c language. the output is fully compatible with micro- chips mplab-c c compiler. the code produced is highly modular and allows easy integration of your own code. mp-driveway is intelligent enough to maintain your code through subsequent code generation. 12.15 seev al ev aluation and pr ogramming system the seeval seeprom designers kit supports all microchip 2-wire and 3-wire serial eeproms. the kit includes everything necessary to read, write, erase or program special features of any microchip seeprom product including smart serials and secure serials. the total endurance disk is included to aid in trade- off analysis and reliability calculations. the total kit can signi?antly reduce time-to-market and result in an optimized system. 12.16 t ruegaug e intellig ent batter y mana g ement the truegauge development tool supports system development with the mta11200b truegauge intelli- gent battery management ic. system design veri?a- tion can be accomplished before hardware prototypes are built. user interface is graphically-oriented and measured data can be saved in a ?e for exporting to microsoft excel. 12.17 k ee l oq ev aluation and pr ogramming t ools k ee l oq evaluation and programming tools support microchips hcs secure data products. the hcs eval- uation kit includes an lcd display to show changing codes, a decoder to decode transmissions, and a pro- gramming interface to program test transmitters.
1996 microchip technology inc. preliminary ds40122b-page 106 pic14000 table 12-1: development tools from microchip product ** mplab integrated development environment mplab c compiler mp-driveway applications code generator fuzzytech -mp explorer/edition fuzzy logic dev. tool *** picmaster / picmaster-ce in-circuit emulator icepic low-cost in-circuit emulator ****pro mate ii universal microchip programmer picstart lite ultra low-cost dev. kit picstart plus low-cost universal dev. kit pic12c508, 509 sw007002 sw006005 em167015/ em167101 dv007003 dv003001 pic14000 sw007002 sw006005 em147001/ em147101 dv007003 dv003001 pic16c52, 54, 54a, 55, 56, 57, 58a sw007002 sw006005 sw006006 dv005001/ dv005002 em167015/ em167101 em167201 dv007003 dv162003 dv003001 pic16c554, 556, 558 sw007002 sw006005 dv005001/ dv005002 em167033/ em167113 ? dv007003 dv003001 pic16c61 sw007002 sw006005 sw006006 dv005001/ dv005002 em167021/ n/a em167205 dv007003 dv162003 dv003001 pic16c62, 62a, 64, 64a sw007002 sw006005 sw006006 dv005001/ dv005002 em167025/ em167103 em167203 dv007003 dv162002 dv003001 pic16c620, 621, 622 sw007002 sw006005 sw006006 dv005001/ dv005002 em167023/ em167109 em167202 dv007003 dv162003 dv003001 pic16c63, 65, 65a, 73, 73a, 74, 74a sw007002 sw006005 sw006006 dv005001/ dv005002 em167025/ em167103 em167204 dv007003 dv162002 dv003001 pic16c642, 662* sw007002 sw006005 em167035/ em167105 ? dv007003 dv162002 dv003001 pic16c71 sw007002 sw006005 sw006006 dv005001/ dv005002 em167027/ em167105 em167205 dv007003 dv162003 dv003001 pic16c710, 711 sw007002 sw006005 sw006006 dv005001/ dv005002 em167027/ em167105 dv007003 dv162003 dv003001 pic16c72 sw007002 sw006005 sw006006 em167025/ em167103 dv007003 dv162002 dv003001 pic16f83 sw007002 sw006005 sw006006 dv005001/ dv005002 em167029/ em167107 dv007003 dv162003 dv003001 pic16c84 sw007002 sw006005 sw006006 dv005001/ dv005002 em167029/ em167107 em167206 dv007003 dv162003 dv003001 pic16f84 sw007002 sw006005 sw006006 dv005001/ dv005002 em167029/ em167107 dv007003 dv162003 dv003001 pic16c923, 924* sw007002 sw006005 sw006006 dv005001/ dv005002 em167031/ em167111 dv007003 dv003001 pic17c42, 42a, 43, 44 sw007002 sw006005 sw006006 dv005001/ dv005002 em177007/ em177107 dv007003 dv003001 *contact microchip technology for availability date **mplab integrated development environment includes mplab-sim simulator and mpasm assembler ***all picmaster and picmaster-ce ordering part numbers above include pro mate ii programmer ****pro mate socket modules are ordered separately. see development systems ordering guide for specic ordering part numbers product truegauge development kit seeval designers kit hopping code security programmer kit hopping code security eval/demo kit all 2 wire and 3 wire serial eeprom's n/a dv243001 n/a n/a mta11200b dv114001 n/a n/a n/a hcs200, 300, 301 * n/a n/a pg306001 dm303001
1996 microchip technology inc. preliminary ds40122b-page 107 pic14000 13.0 electrical characteristics for pic14000 absolute maximum ratings ? ambient temperature under bias.............................................................................................................-55 c to+ 125 c storage temperature ............................................................................................................................. -65 c to +150 c voltage on any pin with respect to v ss (except v dd and mclr ) ...................................................... -0.5v to v dd +0.6v voltage on v dd with respect to v ss .............................................................................................................. 0 to +6.0 v voltage on mclr with respect to v ss (note 2) ...............................................................................................0 to +14 v total power dissipation (note 1) ..............................................................................................................................1.0 w maximum current out of v ss pin ...........................................................................................................................300ma maximum current into v dd pin ..............................................................................................................................250ma input clamp current, i ik (v i <0 or v i > v dd ) ......................................................................................................................... 20ma output clamp current, i ok (v o <0 or v o >v dd ) ................................................................................................................... 20ma maximum output current sunk by any i/o pin .........................................................................................................25ma maximum output current sourced by any i/o pin....................................................................................................25ma maximum current sunk by porta, portc, and portd(combined) ..................................................................200ma maximum current sourced by porta, portc, and porte (combined) ............................................................200ma maximum current sunk by portc and portd (combined) ................................................................................200ma maximum current sourced by portc and portd (combined)...........................................................................200ma note 1: power dissipation is calculated as follows: pdis = v dd x {i dd - i oh } + {(v dd -v oh ) x i oh } + (v o l x i ol ) note 2: voltage spikes below v ss at the mclr pin, inducing currents greater than 80ma, may cause latch-up. thus, a series resistor of 50-100 w should be used when applying a ?ow?level to the mclr pin rather than pulling this pin directly to v ss . ? notice: stresses above those listed under ?bsolute maximum ratings?may cause permanent damage to the device. this is a stress rating only and functional operation of the device at those or any other conditions above those indicated in the operation listings of this speci?ation is not implied. exposure to maximum rating conditions for extended periods may affect device reliability. this document was created with framemake r404
pic14000 ds40122b-page 108 preliminary 1996 microchip technology inc. 13.1 dc characteristics: pic14000 dc characteristics standard operating conditions (unless otherwise stated) operating temperature -40 c t a + 85 c for industrial and 0 c t a +70 c for commercial operating voltage v dd = 2.7v to 6.0v characteristic sym min typ? max units conditions supply voltage v dd 2.7 4.5 6.0 5.5 v v in or hs at fosc 4 mhz hs at fosc > 4 mhz ram data retention voltage (note 1) v dr 1.5 v device in sleep mode v dd start voltage to guarantee power-on reset v por v ss v see section on power-on reset for details v dd rise rate to guarantee power-on reset s vdd 0.05* v/ms see section on power-on reset for details operating current in sleep mode (note 2) during a/d conversion: all analog on and internal oscillator active i pd 1 i pd 1 tbd tbd 900 1250 m a m a v dd = 3.0v v dd = 4.0v comparator interrupt enabled: level-shift, programmable reference, and comparator active i pd 2 i pd 2 75 95 100 125 m a m a v dd = 3.0v, cmoff = 0, lsoff = 0, refoff = 0 v dd = 4.0v, cmoff = 0, lsoff = 0, refoff = 0 all analog off, wdt on (note 5) i pd 3 i pd 3 7.5 10.5 20 28 m a m a v dd = 3.0v v dd = 4.0v all analog off, wdt off (hibernate mode) (note 5) i pd 4 i pd 4 0.9 1.5 12 16 m a m a v dd = 3.0v v dd = 4.0v operating supply current (note 2, 4) internal oscillator mode i dd 2.2 tbd ma fosc = 4 mhz, v dd = 5.5v 1.1 tbd ma fosc = 4 mhz, v dd = 3.0v hs oscillator mode 2.4 1.2 10 tbd tbd tbd ma ma ma fosc = 4 mhz, v dd = 5.5v fosc = 4 mhz, v dd = 3.0v fosc = 20 mhz, v dd = 5.5v * these parameters are characterized but not tested. ? data in ?yp?column is at 5v, 25?c unless otherwise stated. these parameters are for design guidance only and are not tested. note 1: this is the limit to which v dd can be lowered in sleep mode without losing ram data. 2: the supply current is mainly a function of the operating voltage and frequency. other factors such as i/o pin loading and switching rate, oscillator type, internal code execution pattern, and temperature also have an impact on the current consumption. the test conditions for all idd measurements in active operation mode are: osc1=external square wave, from rail to rail; all i/o pins tristated, pulled to v dd . mclr = v dd ; wdt enabled/disabled as speci?d. 3: measured with all inputs at rails, no dc loads. i pd 1 measured with internal oscillator active. 4: i dd values of individual analog module cannot be tested independently but are characterized. 5: worst-case i pd conditions with all con?uration bits unprogrammed. programming con?uration bits may reduce i pd .
1996 microchip technology inc. preliminary ds40122b-page 109 pic14000 13.2 dc characteristics: pic14000 dc characteristics standard operating conditions (unless otherwise stated) operating temperature -40 c ta + 85 c for industrial and 0 c ta +70 c for commercial operating voltage v dd range as described in section 13.1. characteristic sym min typ ? max units conditions input low voltage i/o ports v il schmitt trigger mode v ss 0.2v dd v smbus mode (rc7, rc6, rd0, rd1) v ss 0.6 v smbus bit, misc<3> = 1 mclr , osc1 (in in mode) vss 0.2v dd v osc1 (in hs mode) vss 0.3v dd v input high voltage i/o ports v ih schmitt trigger mode 0.85 v dd ? dd v smbus mode (rc7, rc6, rd0, rd1) 1.4v v dd v smbus bit, misc<3> = 1 portc<5:0> weak pull-up current i purc 50 200 ?400 m av dd = 5v, v pin = v ss input leakage current (notes 1,2) i/o ports, cdac i il 1 m a vss ? v pin ? v dd , pin at hi-impedance mclr 5 m a vss ? v pin ? v dd osc1 5 m a vss ? v pin ? v dd output low voltage i/o ports v ol 0.6 v i ol = 8.5ma, v dd -4.5v, -40 c to +85 c osc2 0.6 v i ol = 1.6ma, v dd -4.5v, -40 c to +85 c output high voltage i/o ports (note 2) v oh v dd -0.7 v i oh = -3.0ma, v dd =4.5v, -40 c to +85 c rc6, rc7, rd0, rd1 (except i 2 c mode) 2.4 v i oh = -2.0ma, v dd =4.5v, -40 c to +85 c osc2 v dd -0.7 v i oh = -1.3ma, v dd =4.5v, -40 c to +85 c capacitive loading specs on output pins osc2 pin c osc2 15 pf all i/o pins except osc2 (in in mode) c io 50 pf scl, sda in i 2 c mode cb 400 pf ? data in ?yp?column is at 5v, 25 c unless otherwise stated. these parameters are for design guidance only and are not tested. note 1: the leakage current on the mclr pin is strongly dependent on the applied voltage level. the speci?d levels represent normal operating conditions. higher leakage current may be measured at different input voltages. 2: negative current is de?ed as coming out of the pin.
pic14000 ds40122b-page 110 preliminary 1996 microchip technology inc. 13.3 timing p arameter symbology the timing parameter symbols have been created following one of the following formats: 1. tpps2pps 3. t cc : st (i 2 c speci?ations only) 2. tpps 4. ts (i 2 c speci?ations only) t f frequency t time lowercase subscripts (pp) and their meanings: pp ck clkout osc osc1 di sdi t0 t0cki io i/o port mc mclr uppercase letters and their meanings: s f fall p period h high r rise i invalid (hi-impedance) v valid l low z hi-impedance i 2 c only aa output access high high buf bus free low low t cc : st (i 2 c speci?ations only) cc hd hold su setup st dat data input hold sto stop condition sta start condition
1996 microchip technology inc. preliminary ds40122b-page 111 pic14000 13.4 timing dia grams and speci cations figure 13-1: external clock timing table 13-1: external clock timing requirements parameter no. sym characteristic min typ? max units conditions f osc external clkin frequency (note 1) dc dc 4 20 mhz mhz hs osc mode (pic14000-04) hs osc mode (pic14000-20) oscillator frequency (note 1) 4 4 4 20 mhz mhz hs osc mode (pic14000-04) hs osc mode (pic14000-20) 1 t osc external clkin period (note 1) 250 50 ns ns hs osc mode (pic14000-04) hs osc mode (pic14000-20) oscillator period (note 1) 250 50 250 250 ns ns hs osc mode (pic14000-04) hs osc mode (pic14000-20) 2 t cy instruction cycle time (note 1) 200 dc ns t cy = 4/f osc 3 t os l, t os h clock in (osc1) high or low time 10 ns hs oscillator 4 t os r, t os f clock in (osc1) rise or fall time 15 ns hs oscillator ? data in ?yp?column is at 5v, 25 c unless otherwise stated. these parameters are for design guidance only and are not tested. note 1: instruction cycle period (t cy ) equals four times the input oscillator time base period. all speci?d values are based on characterization data for that particular oscillator type under standard operating conditions with the device executing code. exceeding these speci?d limits may result in an unstable oscillator operation and/or higher than expected current consumption. all devices are tested to operate at ?in.?values with an external clock applied to the osc1 pin. when an external clock input is used, the ?ax.?cycle time limit is ?c?(no clock) for all devices. 3 3 4 4 1 2 q4 q1 q2 q3 q4 q1 osc1 clkout
pic14000 ds40122b-page 112 preliminary 1996 microchip technology inc. figure 13-2: load conditions v dd /2 cl rl pin pin v ss v ss cl rl = 464 w cl = 50 pf for all pins except osc2 15 pf for osc2 output load condition 1 load condition 2
1996 microchip technology inc. preliminary ds40122b-page 113 pic14000 figure 13-3: clkout and i/o timing table 13-2: clkout and i/o timing requirements parameter no. sym characteristic min typ? max units conditions 10 tosh2ckl osc1 to clkout 15 30 ns note 1 11 tosh2ckh osc1 to clkout 15 30 ns note 1 12 tckr clkout rise time 5 15 ns note 1 13 tckf clkout fall time 5 15 ns note 1 14 tckl2iov clkout to port out valid 0.5t cy +20 ns note 1 15 tiov2ckh port in valid before clkout 0.25 t cy +25 ns note 1 16 tckh2ioi port in hold after clkout 0 ns note 1 17 tosh2iov osc1 (q1 cycle) to port out valid 80 - 100 ns 18 tosh2ioi osc1 (q2 cycle) to port input invalid (i/o in hold time) 100 ns 19 tiov2osh port input valid to osc1 (i/o in setup time) 0ns 20 tior port output rise time 10 25 ns 21 tiof port output fall time 10 25 ns 22?? tinp pbtn pin high or low time 20 ns in mode only 23?? trbp rc<7:4> change int high or low time 20 ns * these parameters are characterized but not tested. ? data in ?yp?column is at 5v, 25 c unless otherwise stated. these parameters are for design guidance only and are not tested. ?? these parameters are asynchronous events not related to any internal clock edges. note 1: measurements are taken in in mode where clkout output is 4 x t osc note: refer to figure 13-2 for load conditions osc1 clkout i/o pin (input) i/o pin (output) q4 q1 q2 q3 10 13 14 17 20, 21 19 18 15 11 12 16 old value new value
pic14000 ds40122b-page 114 preliminary 1996 microchip technology inc. figure 13-4: reset, watchdog timer, oscillator start-up timer (hs mode) and power-up timer timing table 13-3: reset, watchdog timer, oscillator start-up timer and power-up timer requirements parameter no. sym characteristic min typ? max units conditions 30 tmcl mclr pulse width (low) 100 ns v dd = 5v, -40 c to +85 c 31 t wdt watchdog timer timeout period (no prescaler) 7* 18 33* ms v dd = 5v, -40 c to +85 c ss( wdt ) supply sensitivity -12.6 %/v ta = 25 c tc( wdt ) temperature coef?ient 0.5 %/ c v dd = 5v 32 t ost oscillation start-up timer period 1024 t osc 8 t osc ms ms t osc = osc1 period in osc mode 33 t pwrt power up timer period 28* 72 132* ms v dd = 5v, -40 c to +85 c 34 t ioz i/o high impedance from mclr low 100 ns * these parameters are characterized but not tested. ? data in ?yp?column is at 5v, 25 c unless otherwise stated. these parameters are for design guidance only and are not tested. 32 watchdog timer reset pwrt timeout mclr v dd 33 internal por osc timeout internal reset 31 30 i/o pin 34 note: refer to figure 13-2 for load conditions
1996 microchip technology inc. preliminary ds40122b-page 115 pic14000 figure 13-5: timer0 clock timings table 13-4: timer0 clock requirements parameter no. sym characteristic min typ? max units conditions 40 tt0h t0cki high pulse width no prescaler 0.5 t cy + 20* ns with prescaler 10* ns 41 tt0l t0cki low pulse width no prescaler 0.5 t cy + 20* ns with prescaler 10* ns 42 tt0p t0cki period t cy + 40 * n ns n = prescale value (1, 2, 4, ..., 256) * these parameters are characterized but not tested. ? data in ?yp?column is at 5v, 25 c unless otherwise stated. these parameters are for design guidance only and are not tested. note: refer to figure 13-2 for load conditions. 41 42 40 t0cki
pic14000 ds40122b-page 116 preliminary 1996 microchip technology inc. figure 13-6: i 2 c bus start/stop bits timing table 13-5: i 2 c bus start/stop bits requirements parameter no. sym characteristic min typ max units conditions 90 t su : sta start condition 100 khz mode 4700 ns only relevant for repeated start condition setup time 400 khz mode 600 91 t hd : sta start condition 100 khz mode 4000 ns after this period the ?st clock pulse is generated hold time 400 khz mode 600 92 t su : sto stop condition 100 khz mode 4700 ns setup time 400 khz mode 600 93 t hd : sto stop condition 100 khz mode 4000 ns hold time 400 khz mode 600 scl sda start condition stop condition 80 81 82 83 90 91 92 93 note: refer to figure 13-2 for load conditions
1996 microchip technology inc. preliminary ds40122b-page 117 pic14000 figure 13-7: i 2 c bus data timing table 13-8: i 2 c bus data requirements parameter no. sym characteristic min max units conditions 100 t high clock high time 100 khz mode 4.0 m s pic14000 must operate at a minimum of 1.5 mhz 400 khz mode 0.6 m s pic14000 must operate at a minimum of 10 mhz i 2 c module 1.5 t cy 101 t low clock low time 100 khz mode 4.7 m s pic14000 must operate at a minimum of 1.5 mhz 400 khz mode 1.3 m s pic14000 must operate at a minimum of 10 mhz i 2 c module 1.5 t cy 102 t r sda and scl rise time 100 khz mode 1000 ns 400 khz mode 20+0.1 c b 300 ns c b is speci?d to be from 10-400 pf 103 t f sda and scl fall time 100 khz mode 300 ns 400 khz mode 20+0.1 c b 300 ns c b is speci?d to be from 10-400 pf 90 t su : sta start condition setup time 100 khz mode 4.7 m s only relevant for repeated start condition 400 khz mode 0.6 m s 91 t hd : sta start condition hold time 100 khz mode 4.0 m s after this period the ?st clock pulse is generated 400 khz mode 0.6 m s 106 t hd : dat data input hold time 100 khz mode 0 ns 400 khz mode 0 0.9 m s 107 t su : dat data input setup time 100 khz mode 250 ns note 2 400 khz mode 100 ns 92 t su : sto stop condition setup time 100 khz mode 4.7 m s 400 khz mode 0.6 m s 109 t aa output valid from clock 100 khz mode 3500 ns note 1 400 khz mode ns 110 t buf bus free time 100 khz mode 4.7 m s time the bus must be free before a new transmission can start 400 khz mode 1.3 m s c b bus capacitive loading 400 pf note 1: as a transmitter, the device must provide this internal minimum delay time to bridge the unde?ed region (min. 300 ns) of the falling edge of scl to avoid unintended generation of starts or stops. 2: a fast-mode i 2 c-bus device can be used in a standard-mode i 2 c-bus system, but the requirement t su :dat 250ns must then be met. this will automatically be the case if the device does not stretch the low period of the scl signal. if such a device does stretch the low period of the scl signal, it must output the next data bit to the sda line t r max.+t su :dat=1000+250=1250 ns (according to the standard-mode i 2 c bus speci?ation) before the scl line is released. scl sda in sda out 80 93 90 91 92 82 100 99 99 81 96 97 90 91 92 100 101 103 106 107 109 109 110 102 note: refer to figure 13-2 for load conditions
pic14000 ds40122b-page 118 preliminary 1996 microchip technology inc. 13.5 dc and a c characteristics graphs and t ab les f or pic14000 figure 13-9: typical i pd4 vs v dd at 25 c to be determined. figure 13-10: typical i pd3 vs v dd at 25 c to be determined. figure 13-11: v th (input threshold voltage) of osc1 input (in hs mode) vs v dd 3.60 3.40 3.20 3.00 2.80 2.60 2.40 2.20 2.00 1.80 1.60 1.40 1.20 1.00 3.0 3.5 4.0 4.5 5.0 5.5 6.0 6.5 v dd (volts) max (-40 c to 85 c) 25 c typ min (-40 c to 85 c) v th (volts)
1996 microchip technology inc. preliminary ds40122b-page 119 pic14000 figure 13-12: typical operating supply current vs freq (ext clock, 25 c) figure 13-13: maximum operating supply current vs freq (ext clock, -40 to +85 c) 1 10 100 1,000 10,000 10,000 100,000 1,000,000 10,000,000 100,000,000 i dd ( m a) frequency (hz) 6.0 5.5 5.0 4.5 4.0 3.5 3.0 to be determined.
pic14000 ds40122b-page 120 preliminary 1996 microchip technology inc. figure 13-14: maximum i pd1 vs freq (ext clock, -40 to +85 c) figure 13-15: watchdog timer time-out period (t wdt ) vs. temperature (typical) temperature ( c) 12 14 16 18 20 22 24 -40 -30 -20 -10 0 10 20 30 10 wdt time-out period (no prescaler, msec) 40 50 60 70 80 90 100 v dd =5v to be determined.
1996 microchip technology inc. preliminary ds40122b-page 121 pic14000 figure 13-16: wdt timer time-out period vs v dd figure 13-17: transconductance (gm) of hs oscillator vs v dd 10.0 35.0 40.0 45.0 50.0 2 3456 wdt period (ms) v dd (volts) 15.0 20.0 25.0 30.0 5.0 7 max, 85?c max, 70?c typ, 25?c min, 0?c min, -40?c 1000 6000 7000 8000 9000 234567 gm ( m a/v) v dd (volts) 2000 3000 4000 5000 0 min, 85?c typ, 25?c max, -40?c figure 13-18: i oh vs v oh , v dd = 3v* figure 13-19: i oh vs v oh , v dd = 5v* i oh (ma) v oh (volts) -25 -20 -15 -10 -5 0 0 0.5 1 1.5 2 2.5 3 max @ -40?c min @ +85?c typ @25?c 0 -5 -10 -15 -20 -25 -30 -35 -40 -45 -50 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 v oh (volts) i oh (ma) min @ 85 c typ @ 25 c max @ -40 c *note: all pins except rc6, rc7, rd0, rd1,osc2
pic14000 ds40122b-page 122 preliminary 1996 microchip technology inc. figure 13-20: i ol vs v ol , v dd = 3v* 35 30 25 20 15 10 5 0 0 0.5 1 1.5 2 2.5 3 v ol (volts) i ol (ma) min @ -40 c typ @ 25 c min @ +85 c figure 13-21: i ol vs v ol , v dd = 5v* *note: all pins except osc2 min @ -40 c 80 90 70 60 50 40 30 20 10 0 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 v ol (volts) i ol (ma) min @ +85 c typ @ 25 c
pic14000 ds40122b-page 123 preliminary 1996 microchip technology inc. 14.0 analog specifications: pic14000-04 (commercial, industrial) standard operating conditions (unless otherwise stated) operating temperature: -40 c ta +85 c for industrial 0 c ta +70 c for commercial v dd range: 2.7v (min) to 6.0v (max) unless otherwise stated. characteristic sym. min. typ. max. units conditions notes bandgap voltage reference output voltage vo(vref) 1.14 1.19 1.24 v turn-on settling time to < 0.1% ton(vref) 1 10 ms refoff bit in slpcon register ? 0 1 temperature coef?ient tc(vref) 50 ppm/ c measured from 25 c to -40 c, +85 c 1 temperature coef?ient tc(vref) 20 ppm/ c measured from 25 c to 0 c, +70 c 1 supply sensitivity ss(vref) 0.04 ? % / v from vddmin to vddmax 1 operating current (on) idd(vref) 20 30 m a refoff = 0 2 operating current (off) idd(vref) 0 m a refoff = 1 2 programmable current source output current io(cdac) cdac pin = 0v 3 18.75 33.75 48.75 m a adcon1<7:4> = 1111b (full-scale) 1.25 2.25 3.25 m a adcon1<7:4> = 0001b (1 lsb) -0.5 0 0.5 m a adcon1<7:4> = 0000b (zero-scale) resolution res(cdac) 1.25 2.25 3.25 m a 1 lsb relative accuracy (linearity error) racc(cdac) -1/2 +1/2 lsb cdac = 0v turn-on settling time to < 0.1% (reference start-up) ton(cdac) 1 10 ms bias generator (reference) turn-on time (refoff 1 ? 0) 1 turn-on settling time to < 0.1% (reference already on and stable) ton(cdac) 1 10 m s refoff = 0 (constant), adcon1<7:4> 0000b ? 1111b 1 temperature coef?ient tc(cdac) 0.1 %/ c measured from 25 c to tmin, tmax 1 supply sensitivity ss(cdac) 0.2 % / v from vddmin to vddmax 1 output voltage sensitivity vs(cdac) -0.1 -0.01 % / v cdac pin voltage = 0v to vdd - 1.4v output voltage range vo(cdac) 0 vdd-1.4 v operating current (a/d on) idd(cdac) 50 70 m a adcon1<7:4> = 1111b 2 operating current (a/d off) idd(cdac) 0 m a refoff = 1, adoff = 1 2 temperature sensor output voltage vo(temp) 0.92 1.05 1.18 v ta = 25 c supply sensitivity ss(temp) 0.2 % / v from vddmin to vddmax 1 temperature coef?ient k tc 3.2 3.65 4.1 mv/ c measured from 25 c to tmax. includes 2 c temperature calibration tolerance this document was created with framemake r404
1996 microchip technology inc. preliminary ds40122b-page 124 pic14000 temperature sensor (continued) output linearity lin(temp) tbd 1 operating current (sensor on) idd(temp) 150 250 m a tempoff = 0 2 operating current (sensor off) idd(temp) 0 m a tempoff = 1 2 slope reference voltage divider output voltage (srefhi) voh(sref) 1.14 1.19 1.24 v output voltage (sreflo) vol(sref) 0.10 0.13 0.16 v slope reference calibration factor k ref 0.09 0.126 0.16 ta = 25 c, vdd = 5v k ref supply sensitivity ss(k ref ) 0.02 %/v from vddmin to vddmax 1 k ref temperature coef?ient tc(k ref ) 20 ppm/ c from tmin to tmax 1 operating current (a/d on) idd(sref) 55 85 m a adoff = 0 2 operating current (a/d off) idd(sref) 0 m a adoff = 1 2 a/d comparator input offset voltage ioff(adc) -10 2 10 mv measured over common-mode range input common mode voltage range cmr(adc) 0 vdd-1.4 v differential voltage gain gain(adc) 100 db 1 common mode rejection ratio cmrr(adc) 80 db vdd = 5v, ta = 25 c, over common-mode range 1 power supply rejection ratio psrr(adc) 70 db ta = 25 c, vddmin to vddmax 1 operating current (a/d on) idd(adc) 40 65 m a adoff = 0 2 operating current (a/d off) 0 m a adoff = 1 2 programmable reference(s) upper range output voltage coarse resolution fine resolution vo(pref) resc(pref) resf(pref) 0.627 0.418 38.0 4.0 0.792 0.528 48.0 5.0 0.957 0.638 58.0 6.0 v v mv mv ta = 25 c prefx<7:0> = 7fh (127 decimal), max prefx<7:0> = 50h (80 decimal), min prefx<2:0> = constant prefx<7:3> = constant middle range output voltage coarse resolution fine resolution vo(pref) resc(pref) resf(pref) 0.414 0.380 0.342 3.8 0.38 0.523 0.480 0.432 4.8 0.46 0.632 0.580 0.522 5.8 0.54 v v v mv mv ta = 25 c prefx<7:0> = 4f (79 decimal), max prefx<7:0> = 00h (default), mid-point prefx<7:0> = c8h (200 decimal), min prefx<2:0> = constant prefx<7:3> = constant 1 standard operating conditions (unless otherwise stated) operating temperature: -40 c ta +85 c for industrial 0 c ta +70 c for commercial v dd range: 2.7v (min) to 6.0v (max) unless otherwise stated. characteristic sym. min. typ. max. units conditions notes
pic14000 ds40122b-page 125 preliminary 1996 microchip technology inc. programmable reference(s) (continued) lower range output voltage coarse resolution fine resolution vo(pref) resc(pref) resf(pref) 0.304 0.114 38.0 4.0 0.384 0.144 48.0 5.0 0.464 0.174 58.0 6.0 v v mv mv ta = 25 c prefx<7:0> = d7h (215 decimal), max prefx<7:0> = f8h (248 decimal), min prefx<2:0> = constant prefx<7:3> = constant relative accuracy (linearity error) racc(pref) - 1/2 + 1/2 lsb lsb = resolution within selected range settling time to < 1/2 lsb ts(pref) 1 10 m s prefx<7:0> transition from 7fh to ffh 1 temperature coef?ient tc(pref) 0.39 %/ c from tmin to tmax 1 supply sensitivity ss(pref) 0.2 %/v from vddmin to vddmax 1 operating current (on) idd(pref) 5 10 m a cmoff = 0 2 operating current (off) idd(pref) 0 m a cmoff = 1 2 low-voltage detector detect voltage v-(lvd) 2.43 2.55 2.67 v decreasing vdd release voltage v+(lvd) 2.48 2.60 2.72 v increasing vdd hysteresis vhys(lvd) 35 55 75 mv between detect and release trip points operating current (on) idd(lvd) 15 25 m a refoff = 0 2 operating current (off) idd(lvd) 0 m a refoff = 1 2 internal oscillator frequency range fosc(in) 3.0 4.0 5.0 mhz temperature coef?ient tc(in) -0.04 %/ c from tmin to tmax 1 supply sensitivity ss(in) 0.8 %/v from vddmin to vddmax 1 jitter jit(in) 100 ppm 3 sigma from mean 1 start-up time tsu(in) 8 tcycs at power-on reset and exit from sleep 4 operating current (oscillator on) idd(in) 300 500 m a2 operating current (oscillator off) idd(in) 0 m a sleep mode, oscoff = 1 2 voltage regulator control output regulation voltage vo(reg) 5.2 5.9 6.6 v measured with ivreg = 10 m a at ta = 25 c temperature coef?ient tc(vreg) -0.2 %/ c from tmin to tmax 1 operating current (recommended) idd(vreg) 1 10 m a determined by external components operating current 0 if v reg pin is open standard operating conditions (unless otherwise stated) operating temperature: -40 c ta +85 c for industrial 0 c ta +70 c for commercial v dd range: 2.7v (min) to 6.0v (max) unless otherwise stated. characteristic sym. min. typ. max. units conditions notes
1996 microchip technology inc. preliminary ds40122b-page 126 pic14000 programmable reference comparator(s) input offset voltage ioff(comp) -10 3 10 mv tested at 0.5v common-mode voltage input common mode voltage range cmr(comp) 0 vdd-1.4 v 1 differential voltage gain gain(comp) 80 db 1 common mode rejection ratio cmrr(comp) 60 db vdd = 5v, ta = 25 c, over common-mode range 1 power supply rejection ratio psrr(comp) 55 db ta = 25 c, vddmin to vddmax 1 operating current (on) idd(comp) 10 20 m a cmoff = 0 2 operating current (off) idd(comp) 0 m a cmoff = 1 2 level-shift network(s) input current (ra1/rd5 pin) iin(lvs) -3.4 -4.8 -6.2 m a ta = 25 c, ra1/rd5 = 0v (sum pin is open) output voltage vo(lvs) 0.37 0.46 0.55 v ta = 25 c, ra1/rd5 = 0v, (sum pin is open) zeroing mismatch error zm(lvs) 0.02 % 1 output voltage temperature coef?ient tc(lvs) 0.39 %/ c from tmin to tmax 1 output voltage supply sensitivity ss(lvs) 0.2 %/v from vddmin to vddmax 1 operating current (network on) idd(lvs) 5 15 m a lsoff = 0 2 operating current (network off) idd(lvs) 0 m a lsoff = 1 2 standard operating conditions (unless otherwise stated) operating temperature: -40 c ta +85 c for industrial 0 c ta +70 c for commercial v dd range: 2.7v (min) to 6.0v (max) unless otherwise stated. characteristic sym. min. typ. max. units conditions notes
pic14000 ds40122b-page 127 preliminary 1996 microchip technology inc. notes for the analog speci?ations: note 1: this parameter is characterized but not tested. note 2: i dd values of individual analog module cannot be tested independently but are characterized. note 3: calibration temp accuracy is 1 c typical, 2 c max. note 4: guaranteed by design. note 5: refer to an621 for further information on calibration parameters and accuracy. calculations: temperature coef?ients are calculated as: tc = (value @tmax - value @tmin) / ((tmax-tmin) * average(value @tmax,value @tmin)) temperature coef?ient for the internal temperature sensor is calculated as: tc sensor = (sensor voltage @ tmax - sensor voltage @ 25 c ) / (tmax - 25 c ) temperature coef?ients for the bandgap reference and programmable current source are calculated as the larger tc from 25 c to either tmin or tmax supply sensitivities are calculated as: ss = (value@vddmax - value@vddmin)/((vddmax - vddmin)* average(value@vddmax, value@vddmin)) programmable current source output sensitivity is calculated as: vs = (value@(vdd - 1.4v) - value @ 0v)/(vdd - 1.4v) * average(value@(vdd - 1.4v), value @ 0v) calibration accuracy all parameters calibrated at vdd = 5v, ta = 25 c unless noted. 3, 5 accuracy parameter sym. resolution units typ max conditions notes slope reference ratio k ref 0.015% .02% bandgap reference voltage k bg 10 m v .01% temperature sensor output voltage v therm 20 m v .02% temperature sensor slope coef?ient k tc 0.33 m v/ c 6.7% calibrated at 25 c and tmax internal oscillator frequency f osc 10.0 khz 0.14% watchdog timer time-out period t wdt 1 ms 0.5 ms standard operating conditions (unless otherwise stated) operating temperature: -40 c ta +85 c for industrial 0 c ta +70 c for commercial v dd range: 2.7v (min) to 6.0v (max) unless otherwise stated. characteristic sym. min. typ. max. units conditions notes
1996 microchip technology inc. preliminary ds40122b-page 128 pic14000 figure 14-1: bandgap reference output voltage vs. temperature (typical devices shown) figure 14-2: programmable current source vs. temperature (typical devices shown) 1.192 1.190 1.188 1.186 1.184 1.182 1.178 -40 -20 0 20 40 60 80 100 reference output (volts) temperature ( c) -30 -10 10 30 50 70 90 1.180 1.194 2.5 2.3 2.1 1.9 1.7 -40 -20 0 20 40 60 80 100 current source output (ua) temperature ( c) -30 -10 10 30 50 70 90 2.7
pic14000 ds40122b-page 129 preliminary 1996 microchip technology inc. figure 14-3: temperature sensor output voltage vs. temperature (typical devices shown) figure 14-4: slope reference ratio (k ref ) vs. supply voltage (typical devices shown) 1.4 1.3 1.2 1.1 1.0 0.9 0.8 -40 -20 0 20 40 60 80 100 temperature sensor output (volts) temperature ( c) 90 70 50 30 10 -10 -30 2.5 3.5 4.0 4.5 5.0 5.5 6.0 supply voltage (volts) 0.1260 0.1258 0.1256 0.1254 0.1252 0.1250 slope reference ratio (k ref ) 3.0
1996 microchip technology inc. preliminary ds40122b-page 130 pic14000 figure 14-5: slope reference ratio (k ref ) vs. temperature (typical devices shown) figure 14-6: programmable reference output vs. temperature (typical) 0.1260 0.1258 0.1256 0.1254 0.1252 0.1250 0.1248 0.1246 -40 -20 0 20 40 60 80 100 temperature ( c) fixed bandgap reference voltage slope reference ratio (k ref ) 0.7 0.6 0.5 0.4 0.3 -40 -20 0 20 40 60 80 programmable reference output (volts) temperature ( c) 90 70 50 30 10 -10 -30
pic14000 ds40122b-page 131 preliminary 1996 microchip technology inc. figure 14-7: internal rc oscillator frequency vs. supply voltage (typical devices shown) figure 14-8: internal rc oscillator frequency vs. temperature (typical devices shown) 2.5 3.5 4.0 4.5 5.0 5.5 6.0 supply voltage (volts) oscillator frequency (mhz) 3.0 4.2 4.1 4.0 3.9 3.8 3.7 3.5 3.6 4.3 oscillator frequency (mhz) 4.2 4.1 4.0 3.9 3.8 3.7 3.5 3.6 4.3 -40 -20 0 20 40 60 80 100 temperature ( c) 90 70 50 30 10 -10 -30 4.4
1996 microchip technology inc. preliminary ds40122b-page 132 pic14000 notes:
pic14000 1996 microchip technology inc. preliminary ds40122b-page 133 appendix a: pic16/17 microcontrollers a.1 pic14000 de vices pic14000 20 4k 192 tmr0 adtmr i 2 c/ smbus 14 11 22 2.7-6.0 yes internal oscillator, bandgap reference, temperature sensor, calibration factors, low voltage detector, sleep, hibernate, comparators with programmable references (2) 28-pin dip, soic, ssop (.300 mil) maximum frequency of operation (mhz) data memory (bytes) timer module(s) capture/compare/pwm module(s) serial port(s) (spi/i 2 c, usart) parallel slave port slope a/d converter interrupt sources i/o pins voltage range (volts) brown-out reset eprom program memory (x14 words) clock memory peripherals features in-circuit serial programming additional on-chip features packages (high-res) channels this document was created with framemake r404
pic14000 ds40122b-page 134 preliminary 1996 microchip technology inc. a.2 pic16c5x f amil y of de vices pic16c52 4 384 25 tmr0 12 2.5-6.25 33 18-pin dip, soic pic16c54 20 512 25 tmr0 12 2.5-6.25 33 18-pin dip, soic; 20-pin ssop pic16c54a 20 512 25 tmr0 12 2.0-6.25 33 18-pin dip, soic; 20-pin ssop pic16cr54a 20 512 25 tmr0 12 2.0-6.25 33 18-pin dip, soic; 20-pin ssop pic16c55 20 512 24 tmr0 20 2.5-6.25 33 28-pin dip, soic, ssop pic16c56 20 1k 25 tmr0 12 2.5-6.25 33 18-pin dip, soic; 20-pin ssop pic16c57 20 2k 72 tmr0 20 2.5-6.25 33 28-pin dip, soic, ssop pic16cr57b 20 2k 72 tmr0 20 2.5-6.25 33 28-pin dip, soic, ssop pic16c58a 20 2k 73 tmr0 12 2.0-6.25 33 18-pin dip, soic; 20-pin ssop pic16cr58a 20 2k 73 tmr0 12 2.5-6.25 33 18-pin dip, soic; 20-pin ssop all pic16/17 family devices have power-on reset, selectable watchdog timer, selectable code protect and high i/o current capability. packages number of instructions voltage range (volts) i/o pins timer module(s) ram data memory (bytes) (x12 words) program memory rom eprom maximum frequency of operation (mhz) features peripherals memory clock
pic14000 1996 microchip technology inc. preliminary ds40122b-page 135 a.3 pic16cxxx f amil y of de vices pic16c554 20 512 80 tmr0 ? 13 2.5-6.0 18-pin dip, soic; 20-pin ssop pic16c556 20 1k 80 tmr0 3 13 2.5-6.0 18-pin dip, soic; 20-pin ssop pic16c558 20 2k 128 tmr0 3 13 2.5-6.0 18-pin dip, soic; 20-pin ssop pic16c620 20 512 80 tmr0 2 yes 4 13 2.5-6.0 yes 18-pin dip, soic; 20-pin ssop pic16c621 20 1k 80 tmr0 2 yes 4 13 2.5-6.0 yes 18-pin dip, soic; 20-pin ssop pic16c622 20 2k 128 tmr0 2 yes 4 13 2.5-6.0 yes 18-pin dip, soic; 20-pin ssop all pic16/17 family devices have power-on reset, selectable watchdog timer, selectable code protect and high i/o current capability. all pic16c6xxx family devices use serial programming with clock pin rb6 and data pin rb7. maximum frequency of operation (mhz) eprom data memory (bytes) timer module(s) comparator(s) internal reference voltage interrupt sources i/o pins voltage range (volts) brown-out reset packages program memory clock memory peripherals features (x14 words)
pic14000 ds40122b-page 136 preliminary 1996 microchip technology inc. a.4 pic16c6x f amil y of de vices pic16c62 20 2k 128 tmr0, tmr1, tmr2 1 spi/i 2 c 7 22 2.5-6.0 yes 28-pin sdip, soic, ssop pic16c62a (1) 20 2k 128 tmr0, tmr1, tmr2 1 spi/i 2 c 7 22 2.5-6.0 yes yes 28-pin sdip, soic, ssop pic16cr62 (1) 20 2k 128 tmr0, tmr1, tmr2 1 spi/i 2 c 7 22 2.5-6.0 yes yes 28-pin sdip, soic, ssop pic16c63 20 4k 192 tmr0, tmr1, tmr2 2 spi/i 2 c, usart 10 22 2.5-6.0 yes yes 28-pin sdip, soic pic16cr63 (1) 20 4k 192 tmr0, tmr1, tmr2 2 spi/i 2 c, usart 10 22 2.5-6.0 yes yes 28-pin sdip, soic pic16c64 20 2k 128 tmr0, tmr1, tmr2 1 spi/i 2 c yes 8 33 2.5-6.0 yes 40-pin dip; 44-pin plcc, mqfp pic16c64a (1) 20 2k 128 tmr0, tmr1, tmr2 1 spi/i 2 c yes 8 33 2.5-6.0 yes yes 40-pin dip; 44-pin plcc, mqfp, tqfp pic16cr64 (1) 20 2k 128 tmr0, tmr1, tmr2 1 spi/i 2 c yes 8 33 2.5-6.0 yes yes 40-pin dip; 44-pin plcc, mqfp, tqfp pic16c65 20 4k 192 tmr0, tmr1, tmr2 2 spi/i 2 c, usart yes 11 33 2.5-6.0 yes 40-pin dip; 44-pin plcc, mqfp pic16c65a (1) 20 4k 192 tmr0, tmr1, tmr2 2 spi/i 2 c, usart yes 11 33 2.5-6.0 yes yes 40-pin dip; 44-pin plcc, mqfp, tqfp pic16cr65 (1) 20 4k 192 tmr0, tmr1, tmr2 2 spi/i 2 c, usart yes 11 33 2.5-6.0 yes yes 40-pin dip; 44-pin plcc, mqfp, tqfp all pic16/17 family devices have power-on reset, selectable watchdog timer, selectable code protect, and high i/o current capability. all pic16c6x family devices use serial programming with clock pin rb6 and data pin rb7. note 1: please contact your local sales of?e for availability of these devices. maximum frequency of operation (mhz) eprom data memory (bytes) timer module(s) capture/compare/pwm module(s) serial port(s) (spi/i 2 c, usart) parallel slave port interrupt sources i/o pins voltage range (volts) brown-out reset packages program memory clock memory peripherals features rom in-circuit serial programming (x14 words)
pic14000 1996 microchip technology inc. preliminary ds40122b-page 137 a.5 pic16c7x f amil y of de vices pic16c710 20 512 36 tmr0 4 4 13 2.5-6.0 yes yes 18-pin dip, soic; 20-pin ssop pic16c71 20 1k 36 tmr0 4 4 13 2.5-6.0 yes 18-pin dip, soic pic16c711 20 1k 68 tmr0 4 4 13 2.5-6.0 yes yes 18-pin dip, soic; 20-pin ssop pic16c72 20 2k 128 tmr0, tmr1, tmr2 1 spi/i 2 c 5 8 22 2.5-6.0 yes yes 28-pin sdip, soic, ssop pic16c73 20 4k 192 tmr0, tmr1, tmr2 2 spi/i 2 c, usart 5 11 22 2.5-6.0 yes 28-pin sdip, soic pic16c73a (1) 20 4k 192 tmr0, tmr1, tmr2 2 spi/i 2 c, usart 5 11 22 2.5-6.0 yes yes 28-pin sdip, soic pic16c74 20 4k 192 tmr0, tmr1, tmr2 2 spi/i 2 c, usart yes 8 12 33 2.5-6.0 yes 40-pin dip; 44-pin plcc, mqfp pic16c74a (1) 20 4k 192 tmr0, tmr1, tmr2 2 spi/i 2 c, usart yes 8 12 33 2.5-6.0 yes yes 40-pin dip; 44-pin plcc, mqfp, tqfp all pic16/17 family devices have power-on reset, selectable watchdog timer, selectable code protect and high i/o current capability. all pic16c7x family devices use serial programming with clock pin rb6 and data pin rb7. note 1: please contact your local sales of?e for availability of these devices. maximum frequency of operation (mhz) eprom program memory (x14 words) data memory (bytes) timer module(s) capture/compare/pwm module(s) serial port(s) (spi/i 2 c, usart) parallel slave port a/d converter (8-bit) channels interrupt sources i/o pins voltage range (volts) brown-out reset packages clock memory peripherals features in-circuit serial programming
pic14000 ds40122b-page 138 preliminary 1996 microchip technology inc. a.6 pic16c8x f amil y of de vices pic16c84 10 1k 36 64 tmr0 4 13 2.0-6.0 18-pin dip, soic pic16f84 (1) 10 1k 68 64 tmr0 4 13 2.0-6.0 18-pin dip, soic pic16cr84 (1) 10 1k 68 64 tmr0 4 13 2.0-6.0 18-pin dip, soic pic16f83 (1) 10 512 36 64 tmr0 4 13 2.0-6.0 18-pin dip, soic pic16cr83 (1) 10 512 36 64 tmr0 4 13 2.0-6.0 18-pin dip, soic all pic16/17 family devices have power-on reset, selectable watchdog timer, selectable code protect, and high i/o current capability. all pic16c8x family devices use serial programming with clock pin rb6 and data pin rb7. note 1: please contact your local sales of?e for availability of these devices. maximum frequency of operation (mhz) eeprom data eeprom (bytes) data memory (bytes) timer module(s) interrupt sources i/o pins voltage range (volts) packages program memory clock memory peripherals features rom flash
pic14000 1996 microchip technology inc. preliminary ds40122b-page 139 a.7 pic16c9xx f amil y of de vices pic16c923 8 4k 176 tmr0, tmr1, tmr2 1 spi/i 2 c 4 com 32 seg 8 25 27 3.0-6.0 yes 64-pin sdip (1) , tqfp, 68-pin plcc, die pic16c924 8 4k 176 tmr0, tmr1, tmr2 1 spi/i 2 c 5 4 com 32 seg 9 25 27 3.0-6.0 yes 64-pin sdip (1) , tqfp, 68-pin plcc, die all pic16/17 family devices have power-on reset, selectable watchdog timer, selectable code protect and high i/o current capability. all pic16cxx family devices use serial programming with clock pin rb6 and data pin rb7. note 1: please contact your local microchip representative for availability of this package. maximum frequency of operation (mhz) eprom data memory (bytes) timer module(s) capture/compare/pwm module(s) serial port(s) (spi/i 2 c, usart) parallel slave port a/d converter (8-bit) channels interrupt sources i/o pins voltage range (volts) brown-out reset packages program memory clock memory peripherals features in-circuit serial programming input pins lcd module
pic14000 ds40122b-page 140 preliminary 1996 microchip technology inc. a.8 pic17cxx f amil y of de vices pic17c42 25 2k 232 tmr0,tmr1, tmr2,tmr3 2 2 yes yes 11 33 4.5-5.5 55 40-pin dip; 44-pin plcc, mqfp pic17c42a 25 2k 232 tmr0,tmr1, tmr2,tmr3 2 2 yes yes yes 11 33 2.5-5.5 58 40-pin dip; 44-pin plcc, mqfp pic17cr42 25 2k 232 tmr0,tmr1, tmr2,tmr3 2 2 yes yes yes 11 33 2.5-5.5 58 40-pin dip; 44-pin plcc, mqfp pic17c43 25 4k 454 tmr0,tmr1, tmr2,tmr3 2 2 yes yes yes 11 33 2.5-6.0 58 40-pin dip; 44-pin plcc, tqfp, mqfp pic17cr43 25 4k 454 tmr0,tmr1, tmr2,tmr3 2 2 yes yes yes 11 33 2.5-6.0 58 40-pin dip; 44-pin plcc, tqfp, mqfp pic17c44 25 8k 454 tmr0,tmr1, tmr2,tmr3 2 2 yes yes yes 11 33 2.5-6.0 58 40-pin dip; 44-pin plcc, tqfp, mqfp all pic16/17 family devices have power-on reset, selectable watchdog timer, selectable code protect and high i/o current capability. maximum frequency of operation (mhz) eprom ram data memory (bytes) timer module(s) captures serial port(s) (usart) external interrupts interrupt sources i/o pins voltage range (volts) number of instructions packages clock memory peripherals features pwms hardware multiply program memory (w ords) rom
1996 microchip technology inc. preliminary ds40122b-page 141 pic14000 a.9 pin compatibility devices that have the same package type and v dd , v ss and mclr pin locations are said to be pin compatible. this allows these different devices to operate in the same socket. compatible devices may only requires minor software modi?ation to allow proper operation in the application socket (ex., pic16c56 and pic16c61 devices). not all devices in the same package size are pin compatible; for example, the pic16c62 is compatible with the pic16c63, but not the pic16c55. pin compatibility does not mean that the devices offer the same features. as an example, the pic16c54 is pin compatible with the pic16c71, but does not have an a/d converter, weak pull-ups on portb, or interrupts. table a-1: pin compatible devices pin compatible devices package pic12c508, pic12c509 8-pin pic16c54, pic16c54a, pic16cr54a, pic16c56, pic16c58a, pic16cr58a, pic16c61, pic16c554, pic16c556, pic16c558 pic16c620, pic16c621, pic16c622, pic16c710, pic16c71, pic16c711, pic16c83, pic16cr83, pic16c84, pic16c84a, pic16cr84 18-pin 20-pin pic16c55, pic16c57, pic16cr57b 28-pin pic16c62, pic16cr62, pic16c62a, pic16c63, pic16c72, pic16c73, pic16c73a 28-pin pic16c64, pic16cr64, pic16c64a, pic16c65, pic16c65a, pic16c74, pic16c74a 40-pin pic17c42, pic17c43, pic17c44 40-pin
pic14000 ds40122b-page 142 preliminary 1996 microchip technology inc. notes:
1996 microchip technology inc. preliminary ds40122b-page 143 pic14000 index a absolute maximum ratings ............................................. 107 addlw instruction ............................................................ 93 addwf instruction ............................................................ 93 alu ...................................................................................... 7 andlw instruction ............................................................ 93 andwf instruction ............................................................ 93 application notes an607 ........................................................................ 80 assembler ........................................................................ 104 b bcf instruction .................................................................. 94 block diagram pic16c74 .................................................................... 8 block diagrams on-chip reset circuit ................................................ 79 bsf instruction .................................................................. 94 btfsc instruction.............................................................. 94 btfss instruction.............................................................. 95 c c compiler (mp-c) .......................................................... 105 call instruction ................................................................ 95 carry bit ............................................................................... 7 clocking scheme ............................................................... 11 clrf instruction ................................................................ 95 clrw instruction............................................................... 95 clrwdt instruction .......................................................... 96 code examples saving status and w registers in ram.................. 85 comf instruction............................................................... 96 compatibility, upward........................................................... 3 computed goto ................................................................... 23 d dc characteristics ........................................................... 108 decf instruction................................................................ 96 decfsz instruction ........................................................... 96 development support ...................................................... 103 development tools .......................................................... 103 digit carry bit ....................................................................... 7 e electrical characteristics.................................................. 107 f family of devices pic14xxx................................................................ 133 pic16c5x ................................................................ 134 pic16c62x .............................................................. 134 pic16c6x ................................................................ 136 pic16c7x ................................................................ 137 pic16c8x ................................................................ 138 pic17cxx................................................................ 140 fsr.................................................................................... 24 fuzzy logic dev. system ( fuzzy tech?mp) ........... 103, 105 g goto instruction............................................................... 97 i idle_mode ...................................................................... 54 incf instruction ................................................................. 97 incfsz instruction ............................................................ 97 instruction cycle ................................................................ 11 instruction flow/pipelining ................................................. 11 instruction format .............................................................. 91 instruction set addlw ...................................................................... 93 addwf ...................................................................... 93 andlw....................................................................... 93 andwf ...................................................................... 93 bcf ............................................................................ 94 bsf............................................................................. 94 btfsc........................................................................ 94 btfss ........................................................................ 95 call........................................................................... 95 clrf .......................................................................... 95 clrw ......................................................................... 95 clrwdt .................................................................... 96 comf ......................................................................... 96 decf.......................................................................... 96 decfsz ..................................................................... 96 goto ......................................................................... 97 incf ........................................................................... 97 incfsz....................................................................... 97 iorlw........................................................................ 97 iorwf........................................................................ 98 movf ......................................................................... 98 movlw ...................................................................... 98 movwf...................................................................... 98 nop............................................................................ 99 option...................................................................... 99 retfie....................................................................... 99 retlw ....................................................................... 99 return................................................................... 100 rlf........................................................................... 100 rrf .......................................................................... 100 sleep ...................................................................... 100 sublw..................................................................... 101 subwf..................................................................... 101 swapf..................................................................... 102 tris ......................................................................... 102 xorlw .................................................................... 102 xorwf .................................................................... 102 section........................................................................ 91 summary table .......................................................... 92 intcon.............................................................................. 19 iorlw instruction .............................................................. 97 iorwf instruction .............................................................. 98 l loading of pc..................................................................... 23 m mclr ................................................................................. 79 memory organization data memory .............................................................. 14 memory organization ................................................. 13 program memory........................................................ 13 movf instruction................................................................ 98 movlw instruction ............................................................ 98 movwf instruction ............................................................ 98 mpasm assembler .................................................. 103, 104 mp-c c compiler ............................................................. 105 mpsim software simulator ...................................... 103, 105 n nop instruction .................................................................. 99 o opcode ............................................................................... 91 option.............................................................................. 18 option instruction ............................................................ 99 p paging, program memory................................................... 23 pcl..................................................................................... 23 pclath ............................................................................. 23 this document was created with framemake r404
pic14000 ds40122b-page 144 preliminary 1996 microchip technology inc. pcon................................................................................. 22 pd ...................................................................................... 79 picdem-1 low-cost pic16/17 demo board........... 103, 104 picdem-2 low-cost pic16cxx demo board ........ 103, 104 picdem-3 low-cost pic16c9xxx demo board............ 104 picmaster rt in-circuit emulator............................. 103 picstart low-cost development system ................. 103 pie1 ................................................................................... 20 pin compatible devices ................................................... 141 pir1 ................................................................................... 21 por oscillator start-up timer (ost) ................................. 80 power-on reset (por) .............................................. 80 power-up timer (pwrt) ........................................... 80 to .............................................................................. 79 prescaler ............................................................................ 39 pro mate universal programmer............................... 103 r rcv_mode....................................................................... 54 read modify write.............................................................. 35 register file ....................................................................... 14 reset.................................................................................. 79 retfie instruction............................................................. 99 retlw instruction ............................................................. 99 return instruction......................................................... 100 rlf instruction................................................................. 100 rrf instruction ................................................................ 100 s saving w register and status in ram............................ 85 sleep................................................................................ 79 sleep instruction ............................................................ 100 software simulator (mpsim)............................................ 105 special function registers............................................ 15 ssp sspcon.................................................................... 43 sspstat................................................................... 42 stack .................................................................................. 23 overflows.................................................................... 23 underflow ................................................................... 23 sublw instruction........................................................... 101 subwf instruction ........................................................... 101 swapf instruction........................................................... 102 t timer0 tmr0 with external clock.......................................... 39 timer1 switching prescaler assignment................................ 40 timing diagrams and specifications................................ 111 tris instruction ............................................................... 102 w watchdog timer (wdt) ..................................................... 79 x xmit_mode...................................................................... 54 xorlw instruction .......................................................... 102 xorwf instruction .......................................................... 102 z zero bit ................................................................................. 7 list of examples example 3-1: instruction pipeline flow ........................... 11 example 4-1: call of a subroutine in page 1 from page 0............................................... 23 example 4-2: indirect addressing .................................... 24 example 5-1: initializing porta ..................................... 25 example 5-2: initializing portc ..................................... 27 example 5-3: initializing portd ..................................... 35 example 5-4: read modify write instructions on an i/o port ........................................... 35 example 6-1: changing prescaler (timer0 wdt) ....... 40 example 6-2: changing prescaler (wdt timer0) ....... 40 example 10-1: saving status and w registers in ram........................................................ 84 list of figures figure 3-1: pic14000 block diagram ............................ 8 figure 3-2: clock/instruction cycle .............................. 11 figure 4-1: pic14000 program memory map and stack .................................................. 13 figure 4-2: register file map ...................................... 14 figure 4-3: status register .......................................... 17 figure 4-4: option register ......................................... 18 figure 4-5: intcon register ...................................... 19 figure 4-6: pie1 register ............................................ 20 figure 4-7: pir1 register ............................................ 21 figure 4-8: pcon register .......................................... 22 figure 4-9: loading of pc in different situations ........ 23 figure 4-10: indirect/indirect addressing ....................... 24 figure 5-1: porta block diagram .............................. 25 figure 5-2: porta data register ............................... 26 figure 5-3: block diagram of portc<7:6> pins ........ 27 figure 5-4: block diagram of portc<5:4> pins ........ 28 figure 5-5: block diagram of portc<3:0> pins ........ 29 figure 5-6: portc data register ............................... 30 figure 5-7: trisc register ......................................... 31 figure 5-8: block diagram of portd<7:4> pins ........ 32 figure 5-9: block diagram of portd<3:2> pins ....... 32 figure 5-10: block diagram of portd<1:0> pins ........ 33 figure 5-11: portd data register ............................... 33 figure 5-12: trisd register ......................................... 34 figure 5-13: successive i/o operation ......................... 36 figure 6-1: timer0 and watchdog timer block diagram ........................................... 37 figure 6-2: timer0 timing: internal clock/ no prescale ............................................... 38 figure 6-3: timer0 timing: internal clock/ prescale 1:2 .............................................. 38 figure 6-4: timer0 interrupt timing ........................... 38 figure 6-5: timer0 timing with external clock .......... 39 figure 7-1: i 2 c start and stop conditions ................... 41 figure 7-2: i 2 cstat: i 2 c port status register ............ 42 figure 7-3: i 2 ccon: i 2 c port control register ........... 43 figure 7-4: i 2 c 7-bit address format ........................... 44 figure 7-5: i 2 c 10-bit address format ......................... 44 figure 7-6: i 2 c slave-receiver acknowledge ............. 45 figure 7-7: sample i 2 c data transfer ......................... 45 figure 7-8: master - transmitter sequence ................. 46 figure 7-9: master - receiver sequence ..................... 46 figure 7-10: combined format ...................................... 46 figure 7-11: multi-master arbitration (2 masters) .......... 47 figure 7-12: i 2 c clock synchronization ......................... 47 figure 7-13: i 2 c block diagram ..................................... 48 figure 7-14: i 2 c waveforms for reception (7-bit address) ........................................... 50
1996 microchip technology inc. preliminary ds40122b-page 145 pic14000 figure 7-15: i 2c waveforms for transmission (7-bit address) ........................................... 51 figure 7-16: misc register ........................................... 53 figure 7-17: operation of the i 2 c in idle_mode, rcv_mode or xmit_mode ......................... 54 figure 7-18: smhog state machine ............................. 55 figure 8-1: a/d block diagram .................................... 58 figure 8-2: example a/d conversion cycle ................. 59 figure 8-3: a/d capture timer (low byte) ................... 59 figure 8-4: a/d capture timer (high byte) .................. 59 figure 8-5: a/d capture register (low byte) .............. 59 figure 8-6: a/d capture register (high byte) .............. 59 figure 9-1: level-shift networks .................................. 66 figure 9-2: slope reference divider ............................ 67 figure 9-3: comparator and programmable reference block diagram .......................... 68 figure 9-4: programmable reference transfer function ..................................................... 70 figure 9-5: comparator control register ............... 71 figure 9-6: prefa register ........................................ 72 figure 9-7: prefb register ........................................ 72 figure 9-8: voltage regulator circuit ........................... 73 figure 10-1: configuration word..................................... 75 figure 10-2: misc register ........................................... 76 figure 10-3: crystal/ceramic resonator operation (hs osc configuration) ............................ 77 figure 10-4: external clock input operation (hs osc configuration) ............................ 77 figure 10-5: external parallel resonant crystal oscillator circuit ......................................... 77 figure 10-6: external series resonant crystal oscillator circuit ......................................... 78 figure 10-7: simplified block diagram of on-chip reset circuit .............................................. 78 figure 10-8: external power-on reset circuit (for slow v dd power-up) .......................... 80 figure 10-9: interrupt logic schematic .......................... 82 figure 10-10: external (osc1/pbtn) interrupt timing .... 83 figure 10-11: watchdog timer block diagram (with timer0) .............................................. 85 figure 10-12: slpcon register ...................................... 88 figure 10-13: wake-up from sleep and hibernate through interrupt ....................................... 88 figure 10-14: typical in-system serial programming connection ................................................. 90 figure 11-1: general format for instructions ................. 91 figure 13-1: external clock timing .............................. 111 figure 13-2: load conditions ....................................... 112 figure 13-3: clkout and i/o timing .......................... 113 figure 13-4: reset, watchdog timer, oscillator start-up timer (hs mode) and power-up timer timing ...................................................... 114 figure 13-5: timer0 clock timings ............................ 115 figure 13-6: i 2 c bus start/stop bits timing ................. 116 figure 13-7: i 2 c bus data timing ................................ 117 figure 13-9: typical i pd 4 vs vdd ................................ 118 figure 13-10: typical i pd 3 vs vdd ................................ 118 figure 13-11: v th (input threshold voltage) of osc1 input (in hs mode) vs v dd ........ 118 figure 13-12: typical i dd vs freq (ext clock, 25 c) ...... 119 figure 13-13: maximum, i dd vs freq (ext clock, -40 to +85 c) .......................................... 119 figure 13-14: maximum i pd 1 vs freq (ext clock, -40 to +85 c) .......................................... 120 figure 13-15: pic14000 watchdog timer time-out period (t wdt ) vs. temperature (typical) 120 figure 13-16: wdt timer time-out period vs v dd .........121 figure 13-17: transconductance (gm) of hs oscillator vs v dd ......................................................121 figure 13-18: i oh vs v oh , vdd = 3v* ............................121 figure 13-19: i oh vs v oh , vdd = 5v* ............................121 figure 13-20: i ol vs v ol , vdd = 3v* .............................122 figure 13-21: i ol vs v ol , vdd = 5v* .............................122 figure 14-1: bandgap reference output voltage vs. temperature (typical devices shown) ..........................128 figure 14-2: programmable current source vs. temperature (typical devices shown) ..........................128 figure 14-3: temperature sensor output voltage vs. temperature (typical devices shown) ..........................129 figure 14-4: slope reference ratio (k ref ) vs. supply voltage (typical devices shown) ..........................129 figure 14-5: slope reference ratio (k ref ) vs. temperature (typical devices shown) ..........................130 figure 14-6: programmable reference output vs. temperature (typical) .............130 figure 14-7: internal rc oscillator frequency vs. supply voltage (typical devices shown) ..........................131 figure 14-8: internal rc oscillator frequency vs. temperature (typical devices shown) ..........................131 list of tables table 3-1: pin descriptions ........................................... 9 table 4-1: calibration data overview.......................... 13 table 4-2: calibration constant addresses................. 14 table 4-3: special function registers for the pic14000 ................................................... 15 table 5-1: port rc0 pin configuration summary........ 28 table 6-1: summary of timer0 registers.................. 40 table 6-2: registers associated with timer0 .............. 40 table 7-1: i 2 c bus terminology .................................. 44 table 7-2: data transfer received byte actions ........ 49 table 7-3: registers associated with i 2 c operation .. 52 table 8-1: a/d channel assignment ........................... 60 table 8-2: programmable current source selection... 61 table 8-3: a/d control and status register 0 ............. 62 table 8-4: a/d control and status register 1 ............. 63 table 8-5: porta and portd configuration ............ 63 table 8-6: cdac capacitor selection (examples for full scale of 3.5v and 1.5v) ................. 64 table 9-1: programmable reference coarse range selection ......................................... 69 table 9-2: programmable reference fine range selection ......................................... 70 table 10-1: ceramic resonators................................... 77 table 10-2: capacitor selection for crystal oscillator .................................................... 77 table 10-3: status bits and their significance ............. 79 table 10-4: reset condition for special registers ...... 80 table 10-5: reset conditions for registers ................. 81 table 10-6: summary of power management options ....................................................... 86 table 11-1: opcode field descriptions ......................... 91 table 11-2: pic14000 instruction set ........................... 92 table 12-1: development tools from microchip......... 106 table 13-1: external clock timing requirements ....... 111
pic14000 ds40122b-page 146 preliminary 1996 microchip technology inc. table 13-2: clkout and i/o timing requirements .. 113 table 13-3: reset, watchdog timer, oscillator start-up timer and power-up timer requirements .......................................... 114 table 13-4: timer0 clock requirements .................... 115 table 13-5: i 2 c bus start/stop bits requirements...... 116 table 13-8: i 2 c bus data requirements .................... 117 table a-1: pin compatible devices ........................... 141
1996 microchip technology inc. preliminary ds40122b-page 147 pic14000 on-line support microchip provides two methods of on-line support. these are the microchip bbs and the microchip world wide web (www) site. use microchip's bulletin board service (bbs) to get current information and help about microchip products. microchip provides the bbs communication channel for you to use in extending your technical staff with micro- controller and memory experts. to provide you with the most responsive service possible, the microchip systems team monitors the bbs, posts the latest component data and software tool updates, provides technical help and embedded systems insights, and discusses how microchip products pro- vide project solutions. the web site, like the bbs, is used by microchip as a means to make ?es and information easily available to customers. to view the site, the user must have access to the internet and a web browser, such as netscape or microsoft explorer. files are also available for ftp download from our ftp site. connecting to the microchip internet web site the microchip web site is available by using your favor ite internet browser to attach to: www.microchip.com the ?e transfer site is available by using an ftp ser- vice to connect to: ftp.mchip.com/biz/mchip the web site and ?e transfer site provide a variety of services. users may download ?es for the latest development tools, data sheets, application notes, user's guides, articles and sample programs. a vari- ety of microchip speci? business information is also available, including listings of microchip sales of?es, distributors and factory representatives. other data available for consideration is: latest microchip press releases technical support section with frequently asked questions design tips device errata job postings microchip consultant program member listing links to other useful web sites related to microchip products connecting to the microchip bbs connect worldwide to the microchip bbs using either the internet or the compuserve communications net- work. internet: you can telnet or ftp to the microchip bbs at the address: mchipbbs.microchip.com compuser ve comm unications netw ork: when using the bbs via the compuserve network, in most cases, a local call is your only expense. the microchip bbs connection does not use compuserve membership services, therefore you do not need compuserve membership to join microchip's bbs. there is no charge for connecting to the microchip bbs. the procedure to connect will vary slightly from country to country. please check with your local compuserve agent for details if you have a problem. compuserve service allow multiple users various baud rates depending on the local point of access. the following connect procedure applies in most loca- tions. 1. set your modem to 8-bit, no parity, and one stop (8n1). this is not the normal compuserve setting which is 7e1. 2. dial your local compuserve access number. 3. depress the key and a garbage string will appear because compuserve is expecting a 7e1 setting. 4. type +, depress the key and ?ost name: will appear. 5. type mchipbbs, depress the key and you will be connected to the microchip bbs. in the united states, to ?d the compuserve phone number closest to you, set your modem to 7e1 and dial (800) 848-4480 for 300-2400 baud or (800) 331-7166 for 9600-14400 baud connection. after the system responds with ?ost name:? type network, depress the key and follow compuserve's directions. for voice information (or calling from overseas), you may call (614) 723-1550 for your local compuserve number. microchip regularly uses the microchip bbs to distribute technical information, application notes, source code, errata sheets, bug reports, and interim patches for microchip systems software products. for each sig, a moderator monitors, scans, and approves or disap- proves ?es submitted to the sig. no executable ?es are accepted from the user community in general to limit the spread of computer viruses. systems information and upgrade hot line the systems information and upgrade line provides system users a listing of the latest versions of all of microchip's development systems software products. plus, this line provides information on how customers can receive any currently available upgrade kits.the hot line numbers are: 1-800-755-2345 for u.s. and most of canada, and 1-602-786-7302 for the rest of the world. trademarks: the microchip name, logo, pic, picstart, picmaster, and are registered trademarks of microchip technology incorporated in the u.s.a. and other coun- tries. flex rom, mplab, pro mate, and fuzzy lab, are trademarks and sqtp is a service mark of microchip in the u.s.a. fuzzy tech is a registered trademark of inform software corporation. ibm, ibm pc-at are registered trademarks of international business machines corp. pentium is a trademark of intel corporation. windows is a trademark and ms-dos, microsoft windows are registered trade- marks of microsoft corporation. compuserve is a regis- tered trademark of compuserve incorporated. all other trademarks mentioned herein are the property of their respective companies. 960513 this document was created with framemake r404
pic14000 ds40122b-page 148 preliminary 1996 microchip technology inc. reader response it is our intention to provide you with the best documentation possible to ensure successful use of your microchip prod- uct. if you wish to provide your comments on organization, clarity, subject matter, and ways in which our documentation can better serve you, please fax your comments to the technical publications manager at (602) 786-7578. please list the following information, and use this outline to provide us with your comments about this data sheet. 1. what are the best features of this document? 2. how does this document meet your hardware and software development needs? 3. do you ?d the organization of this data sheet easy to follow? if not, why? 4. what additions to the data sheet do you think would enhance the structure and subject? 5. what deletions from the data sheet could be made without affecting the overall usefulness? 6. is there any incorrect or misleading information (what and where)? 7. how would you improve this document? 8. how would you improve our software, systems, and silicon products? to : technical publications manager re: reader response total pages sent from: name company address city / state / zip / country telephone: (_______) _________ - _________ application (optional): would you like a reply? y n device: literature number: questions: fax: (______) _________ - _________ ds40122b pic14000
1996 microchip technology inc. preliminary ds30444c-page 149 pic14000 pic14000 product identification system to order or to obtain information (e.g., on pricing or delivery), please use the listed part numbers, and refer to the factory or the listed sales of?es. pattern: 3-digit pattern code for qtp (blank otherwise) package: sp = 300 mil pdip so = 300 mil soic (gull wing, 300 mil body) ss = 209 mil ssop jw = windowed cerdip temperature - = 0?c to +70?c range: i = -40?c to +85?c frequency 04 = 4 mhz range: 20 = 20 mhz device: pic14000: v dd range 2.7v to 6.0v pic14000t: v dd range 2.7v to 6.0v (tape & reel) part no. -xx x /xx xxx this document was created with framemake r404
pic14000 ds30444c-page 150 preliminary 1996 microchip technology inc. notes:
1996 microchip technology inc. preliminary ds30444c-page 151 pic14000 notes:
? 2002 microchip technology inc. information contained in this publication regarding device applications and the like is intended through suggestion only and may be superseded by updates. it is your responsibility to ensure that your application meets with your specifications. no representation or warranty is given and no liability is assumed by microchip technology incorporated with respect to the accuracy or use of such information, or infringement of patents or other intellectual property rights arising from such use or otherwise. use of microchip?s products as critical com- ponents in life support systems is not authorized except with express written approval by microchip. no licenses are con- veyed, implicitly or otherwise, under any intellectual property rights. trademarks the microchip name and logo, the microchip logo, filterlab, k ee l oq , microid, mplab, pic, picmicro, picmaster, picstart, pro mate, seeval and the embedded control solutions company are registered trademarks of microchip tech- nology incorporated in the u.s.a. and other countries. dspic, economonitor, fansense, flexrom, fuzzylab, in-circuit serial programming, icsp, icepic, microport, migratable memory, mpasm, mplib, mplink, mpsim, mxdev, picc, picdem, picdem.net, rfpic, select mode and total endurance are trademarks of microchip technology incorporated in the u.s.a. serialized quick turn programming (sqtp) is a service mark of microchip technology incorporated in the u.s.a. all other trademarks mentioned herein are property of their respective companies. ? 2002, microchip technology incorporated, printed in the u.s.a., all rights reserved. printed on recycled paper. microchip received qs-9000 quality system certification for its worldwide headquarters, design and wafer fabrication facilities in chandler and tempe, arizona in july 1999. the company?s quality system processes and procedures are qs-9000 compliant for its picmicro ? 8-bit mcus, k ee l oq ? code hopping devices, serial eeproms and microperipheral products. in addition, microchip ? s quality system for the design and manufacture of development systems is iso 9001 certified. note the following details of the code protection feature on picmicro ? mcus.  the picmicro family meets the specifications contained in the microchip data sheet.  microchip believes that its family of picmicro microcontrollers is one of the most secure products of its kind on the market to day, when used in the intended manner and under normal conditions.  there are dishonest and possibly illegal methods used to breach the code protection feature. all of these methods, to our knowl - edge, require using the picmicro microcontroller in a manner outside the operating specifications contained in the data sheet. the person doing so may be engaged in theft of intellectual property.  microchip is willing to work with the customer who is concerned about the integrity of their code.  neither microchip nor any other semiconductor manufacturer can guarantee the security of their code. code protection does not mean that we are guaranteeing the product as ? unbreakable ? .  code protection is constantly evolving. we at microchip are committed to continuously improving the code protection features of our product. if you have any further questions about this matter, please contact the local sales office nearest to you.
? 2002 microchip technology inc. m americas corporate office 2355 west chandler blvd. chandler, az 85224-6199 tel: 480-792-7200 fax: 480-792-7277 technical support: 480-792-7627 web address: http://www.microchip.com rocky mountain 2355 west chandler blvd. chandler, az 85224-6199 tel: 480-792-7966 fax: 480-792-7456 atlanta 500 sugar mill road, suite 200b atlanta, ga 30350 tel: 770-640-0034 fax: 770-640-0307 boston 2 lan drive, suite 120 westford, ma 01886 tel: 978-692-3848 fax: 978-692-3821 chicago 333 pierce road, suite 180 itasca, il 60143 tel: 630-285-0071 fax: 630-285-0075 dallas 4570 westgrove drive, suite 160 addison, tx 75001 tel: 972-818-7423 fax: 972-818-2924 detroit tri-atria office building 32255 northwestern highway, suite 190 farmington hills, mi 48334 tel: 248-538-2250 fax: 248-538-2260 kokomo 2767 s. albright road kokomo, indiana 46902 tel: 765-864-8360 fax: 765-864-8387 los angeles 18201 von karman, suite 1090 irvine, ca 92612 tel: 949-263-1888 fax: 949-263-1338 new york 150 motor parkway, suite 202 hauppauge, ny 11788 tel: 631-273-5305 fax: 631-273-5335 san jose microchip technology inc. 2107 north first street, suite 590 san jose, ca 95131 tel: 408-436-7950 fax: 408-436-7955 toronto 6285 northam drive, suite 108 mississauga, ontario l4v 1x5, canada tel: 905-673-0699 fax: 905-673-6509 asia/pacific australia microchip technology australia pty ltd suite 22, 41 rawson street epping 2121, nsw australia tel: 61-2-9868-6733 fax: 61-2-9868-6755 china - beijing microchip technology consulting (shanghai) co., ltd., beijing liaison office unit 915 bei hai wan tai bldg. no. 6 chaoyangmen beidajie beijing, 100027, no. china tel: 86-10-85282100 fax: 86-10-85282104 china - chengdu microchip technology consulting (shanghai) co., ltd., chengdu liaison office rm. 2401, 24th floor, ming xing financial tower no. 88 tidu street chengdu 610016, china tel: 86-28-6766200 fax: 86-28-6766599 china - fuzhou microchip technology consulting (shanghai) co., ltd., fuzhou liaison office unit 28f, world trade plaza no. 71 wusi road fuzhou 350001, china tel: 86-591-7503506 fax: 86-591-7503521 china - shanghai microchip technology consulting (shanghai) co., ltd. room 701, bldg. b far east international plaza no. 317 xian xia road shanghai, 200051 tel: 86-21-6275-5700 fax: 86-21-6275-5060 china - shenzhen microchip technology consulting (shanghai) co., ltd., shenzhen liaison office rm. 1315, 13/f, shenzhen kerry centre, renminnan lu shenzhen 518001, china tel: 86-755-2350361 fax: 86-755-2366086 hong kong microchip technology hongkong ltd. unit 901-6, tower 2, metroplaza 223 hing fong road kwai fong, n.t., hong kong tel: 852-2401-1200 fax: 852-2401-3431 india microchip technology inc. india liaison office divyasree chambers 1 floor, wing a (a3/a4) no. 11, o?shaugnessey road bangalore, 560 025, india tel: 91-80-2290061 fax: 91-80-2290062 japan microchip technology japan k.k. benex s-1 6f 3-18-20, shinyokohama kohoku-ku, yokohama-shi kanagawa, 222-0033, japan tel: 81-45-471- 6166 fax: 81-45-471-6122 korea microchip technology korea 168-1, youngbo bldg. 3 floor samsung-dong, kangnam-ku seoul, korea 135-882 tel: 82-2-554-7200 fax: 82-2-558-5934 singapore microchip technology singapore pte ltd. 200 middle road #07-02 prime centre singapore, 188980 tel: 65-6334-8870 fax: 65-6334-8850 taiwan microchip technology taiwan 11f-3, no. 207 tung hua north road taipei, 105, taiwan tel: 886-2-2717-7175 fax: 886-2-2545-0139 europe denmark microchip technology nordic aps regus business centre lautrup hoj 1-3 ballerup dk-2750 denmark tel: 45 4420 9895 fax: 45 4420 9910 france microchip technology sarl parc d?activite du moulin de massy 43 rue du saule trapu batiment a - ler etage 91300 massy, france tel: 33-1-69-53-63-20 fax: 33-1-69-30-90-79 germany microchip technology gmbh gustav-heinemann ring 125 d-81739 munich, germany tel: 49-89-627-144 0 fax: 49-89-627-144-44 italy microchip technology srl centro direzionale colleoni palazzo taurus 1 v. le colleoni 1 20041 agrate brianza milan, italy tel: 39-039-65791-1 fax: 39-039-6899883 united kingdom arizona microchip technology ltd. 505 eskdale road winnersh triangle wokingham berkshire, england rg41 5tu tel: 44 118 921 5869 fax: 44-118 921-5820 03/01/02 w orldwide s ales and s ervice


▲Up To Search▲   

 
Price & Availability of PIC14000-04SO

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X